Script to capture logs based on REQUEST iD


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Script to capture logs based on REQUEST iD
# 1  
Old 07-08-2015
Script to capture logs based on REQUEST iD

Hi All,
I am a newbie,
I am looking for a script that can capture logs based on a request id and store it in tmp folder
Log files looks like this"

Code:
 - 2015-07-08 10:59:17,100 INFO   RequestId -> 923559008 Inside test method
 - 2015-07-08 10:59:17,100 INFO   RequestId -> 923559008 End of some test method method
 - 2015-07-08 10:59:17,100 INFO   RequestId -> 923559008 test test"

Trying to capture using Request id and request changes randomly, so it has to be a variable where i can set the value of the id and capture the logs in particular location.
Would really appreciate your help

Last edited by Corona688; 07-08-2015 at 12:13 PM..
# 2  
Old 07-08-2015
Code:
var="123456789"
grep -w "$var" filename

# 3  
Old 07-08-2015
Thanks CORONA,

to add to this, few more questions
Q1:How to capture from a different location where I am currently in
My Log file are in one location eg: Suppose the request id is printed in log file named as test_1.log and this is located in cd /servers/xxx/yyyy. and I am directory cd /tmp, so how to stay in cd /tmp and try to capture logs.
Q2: Where to create the executable script and the reply you posted what filename is it the filename of the outfile name? or filename i should use the file name from where i want to grab the request id?
Q3: Looking to execute the script from cd /tmp and get the output at same place in a form of log file which can be analyzed for results.

Thanks
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

If I ran perl script again,old logs should move with today date and new logs should generate.

Appreciate help for the below issue. Im using below code.....I dont want to attach the logs when I ran the perl twice...I just want to take backup with today date and generate new logs...What I need to do for the below scirpt.............. 1)if logs exist it should move the logs with extention... (1 Reply)
Discussion started by: Sanjeev G
1 Replies

2. Shell Programming and Scripting

Capture run time of python script executed inside shell script

I have bash shell script which is internally calling python script.I would like to know how long python is taking to execute.I am not allowed to do changes in python script.Please note i need to know execution time of python script which is getting executed inside shell .I need to store execution... (2 Replies)
Discussion started by: Adfire
2 Replies

3. Solaris

Capture PRSTAT based on CPU usage percentage

Hi, Recently i have write a simple script to capture CPU high usage based on prstat but i found out that it did capture correctly. I need to capture the rows that contains CPU usage more than 3%. Below line which i thought will capture CPU usage based CPU column in prstat(9th parameter) which is... (3 Replies)
Discussion started by: tharmendran
3 Replies

4. UNIX for Dummies Questions & Answers

How to Capture Informatica Error logs?

HI Team , Is there a way to capture information logs ( session or workflow ) and grep only ERROR or FAIL messages and send to email distro using mailx or sendmail option. I have around 200 sessions running on daily basis and this script has to run every day , and capture only error... (0 Replies)
Discussion started by: Perlbaby
0 Replies

5. Shell Programming and Scripting

How to capture the exit code of a shell script in a perl script.?

hi, i want to pop up an alert box using perl script. my requirement is. i am using a html page which calls a perl script. this perl script calls a shell script.. after the shell script ends its execution, i am using exit 0 to terminate the shell script successfully and exit 1 to terminate the... (3 Replies)
Discussion started by: Little
3 Replies

6. Shell Programming and Scripting

How to capture exit code of child script and send it to parent script?

#!/usr/local/bin/bash set -vx /prod/HotelierLinks/palaceLink/bin/PalacefilesWait /prod/HotelierLinks/palaceLink/bin/prodEnvSetup 03212013 & if then echo "fatal error: Palace/HardRock failed!!!!" 1>&2 echo "Palace Failed" | mail -s "Link Failed at Palace/HardRock" -c... (1 Reply)
Discussion started by: aroragaurav.84
1 Replies

7. Programming

Creating a web based id request form

Please pardon my ignorance, but I need to create a web-based form which can be used to request access to the unix servers in our environment. It just needs to have input fields for basic info (name, dept., etc.), and perhaps a drop-down box with the names of the servers. The form will be submitted... (2 Replies)
Discussion started by: wjssj
2 Replies

8. Shell Programming and Scripting

how to create one newfile and wants include some lines based on user request

I have one request, First it has to create one file and in that file it has to include some lines based on user request. Suppose user requested 10, then script needs to add 10 lines like below QAEVO_A1|A1 QAEVO_A2|A2 QAEVO_A3|A3 QAEVO_A4|A4 QAEVO_A5|A5 QAEVO_A6|A6 QAEVO_A7|A7... (8 Replies)
Discussion started by: sridhusha
8 Replies

9. Shell Programming and Scripting

Capture lines based on keywords

Hello everyone, I am trying to write a script that will capture few lines from a text file based on 2 keywords in the first line and 1 keyword in the last one. It could also be based on the first line only + the folllowing 3 lines. Could some one help or give directions. Thanks. (4 Replies)
Discussion started by: nimo
4 Replies
Login or Register to Ask a Question