Last active
October 16, 2017 04:46
-
-
Save roblogic/b267a8da77ba172ff3cdf6a03b4e4d9c to your computer and use it in GitHub Desktop.
Trace process thread in a log file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# test script | |
# trace Web Service logic by process id | |
# e.g. paxservices-CEB2.0-1435811146723-211 | |
USAGE='Usage: tracelog <logfile_name> <process_id>' | |
[ $2 ] || { echo $USAGE ; echo ; exit ; } | |
LOGFILE_NAME=$1 | |
PROCESS_ID=$2 | |
# find the process thread | |
TOP=`grep -a -n $PROCESS_ID $LOGFILE_NAME | head -1 | awk -F: '{print $1}'` | |
BOT=`grep -a -n $PROCESS_ID $LOGFILE_NAME | tail -1 | awk -F: '{print $1}'` | |
sed -n "${TOP},${BOT}p" $LOGFILE_NAME |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment