Visit Our UNIX and Linux User Community


Grep yesterday logs from weblogic logs


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Grep yesterday logs from weblogic logs
# 1  
Old 11-04-2008
Grep yesterday logs from weblogic logs

Hi,

I am trying to write a script which would go search and get the info from the logs based on yesterday timestamp and write yesterday logs in new file. The log file format is as follows:
""""""""""""""""""""""""""
ontent&paf_ps=_st_800005%3Dnormal%26_ac_800005%3Dac%26_pid%3D800005%26_md_800005%3Dview&prefixBoUrl=/WinVision/action/readMessageFromSearch.do&expanded-path=messages&idMessage=2740"
**** debug Tue Nov 04 11:09:02 MET 2008 1225793342478 /atosorigin/api12portlet/API12ProxyProvider url found : /WinVision/webvision-views/images/star.gif"
**** debug Tue Nov 04 11:09:02 MET 2008 1225793342479 /atosorigin/api12portlet/API12ProxyProvider url Ignored
**** debug Tue Nov 04 11:09:02 MET 2008 1225793342479 /atosorigin/api12portlet/API12ProxyProvider url found : /WinVision/webvision-views/images/star.gif"
**** debug Tue Nov 04 11:09:02 MET 2008 1225793342479 /atosorigin/api12portlet/API12ProxyProvider url Ignored
**** debug Tue Nov 04 11:09:02 MET 2008 1225793342479 /atosorigin/api12portlet/API12ProxyProvider url found : /WinVision/webvision-views/images/star.gif"
**** debug Tue Nov 04 11:09:02 MET 2008 1225793342479 /atosorigin/api12portlet/API12ProxyProvider url Ignored
**** debug Tue Nov 04 11:09:02 MET 2008 1225793342479 /atosorigin/api12portlet/API12ProxyProvider url found : /WinVision/webvision-views/images/star.gif"
**** debug Tue Nov 04 11:09:02 MET 2008 1225793342480 /atosorigin/api12portlet/API12ProxyProvider url Ignored
**** debug Tue Nov 04 11:09:02 MET 2008 1225793342480 /atosorigin/api12portlet/API12ProxyProvider url found : /WinVision/action/readMessageFromSearch.do?expanded-path=messages&idMessage=2740"
**** debug Tue Nov 04 11:09:02 MET 2008 1225793342481 /atosorigin/api12portlet/API12ProxyProvider modified url : /winportal/MSS/home?paf_portalId=default&paf_communityId=100001&paf_pageId=400001&paf_dm=shared&paf_gear_id=800005& paf_gm=content&paf_ps=_st_800005%3Dnormal%26_ac_800005%3Dac%26_pid%3D800005%26_md_800005%3Dview&pref ixBoUrl=/WinVision/action/readMessageFromSearch.do&expanded-path=messages&idMessage=2740"
**** debug Tue Nov 04 11:09:02 MET 2008 1225793342482 /atosorigin/api12portlet/API12ProxyProvider Function modifyContentUrls - End
**** info Tue Nov 04 11:09:02 MET 2008 1225793342482 /atosorigin/api12portlet/portletClass set Portlet HTML content in request for display
**** debug Tue Nov 04 11:09:02 MET 2008 1225793342482 /atosorigin/api12portlet/portletClass page Help url (sent to droplet) : /null
**** debug Tue Nov 04 11:09:02 MET 2008 1225793342482 /atosorigin/api12portlet/portletClass Lancement du dispatcher sur /index.jsp
"""""""""""""""""""""""""""""""""""""""""""""""""

The timestamp format in the logs is as follows "Tue Nov 04 11:09:44 MET 2008"
# 2  
Old 11-04-2008
Have a look into https://www.unix.com/answers-frequent...rithmetic.html to get a pattern you can grep. Also please use [ code ] [ /code ] tags to display code, logs, etc.
# 3  
Old 11-04-2008
Hi zaxxon,

thanks for your reply.

Right now i am using following funtion for yesterday date:

today=`date +%Y%m%d`
yesterday=`expr $today - 1`
echo $yesterday
20081103

The output is comming in YYYYMMDD format.So my problem is that i m not able to convert this format in "Tue Nov 04 11:27:30 MET 2008" which is mentioned in log file.
# 4  
Old 11-04-2008
I just read the thread about this example - it is no good solution since when you have 1.12.2008 for example, it will show 20081200 which is good for nothing. Even 2 days before that date, you get something like 20081199 which is useless too.
I would go with one of the perl solutions or with this one:
Code:
YESTERDAY=`TZ=GMT+24 date "+%Y%m%d"`
echo ${YESTERDAY}


Previous Thread | Next Thread
Test Your Knowledge in Computers #210
Difficulty: Easy
Routing protocols like OSPF calculate the shortest route to a destination through the network based on a computer algorithm.
True or False?

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Grep last 5 mins from logs

Hi, system date format Thu Jun 13 12:55:18 EDT 2019 My log date format 09.148.192.60 - - "GET /akamai/sureroute-test-object.html HTTP/1.1" 404 231 can someone please help me, how to get last 5mins of logs please ? I need the command Please wrap your samples/codes in CODE TAGS,... (3 Replies)
Discussion started by: scazed
3 Replies

2. 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

3. Shell Programming and Scripting

Script to grep logs for Errors

Hi Guys, I want to write a script which can grep the logs (server.log) from a file for Error String and output to a other file. Problems: How to know about the errors only between the current restart and not in previous as server.log has earlier restarts also? thanks for the help! Much... (5 Replies)
Discussion started by: ankur328
5 Replies

4. UNIX for Dummies Questions & Answers

Grep Logs That Are Updating

Hello all. I am new to this forum and also very new to using grep - so please excuse me if this question is not in the correct forum and/or is not pertinent to this website. I use greps like this: gunzip -c L:\System1\SailLogger_20071019* L:\System2\SailLogger_20071019*... (14 Replies)
Discussion started by: Carl2013
14 Replies

5. Shell Programming and Scripting

script to grep outofmemory message in logs

I have prepare script to grep for outofmemory messages in the logs. I need help in modifying script. I have implemented small logic. The outofmemory messages form six logs will store in variables. var1=`grep -i outofmemory $tomcat1logs | sed -n '$p'| sed -n -e "s/.*\(outofmemory\).*/\1/p"`... (6 Replies)
Discussion started by: coolguyamy
6 Replies

6. Linux

search on weblogic logs with date time ranges

Hi All, The developers want me to search and capture the weblogic log, you know this big logs of htmls. They want to me to have ranges on the date and time. Like from "2010-01-20 14:04:46,186" to "2010-01-20 15:00:12,490" I can only do this, cat /usr/local/bea/logs_prod1/debug.log... (1 Reply)
Discussion started by: itik
1 Replies

7. Shell Programming and Scripting

search on weblogic logs with date time ranges 2

Hi All, The developers want me to search and capture the weblogic log, you know this big logs of htmls. They want to me to have ranges on the date and time. Like from "2010-01-20 14:04:46,186" to "2010-01-20 15:00:12,490" I can only do this, cat /usr/local/bea/logs_prod1/debug.log |... (1 Reply)
Discussion started by: itik
1 Replies

8. Shell Programming and Scripting

how to grep the logs for two particular timestamp

Hi, could anyone help me out how to write a script, to grep the two timestamp from a particular file, so that it will list out all the logs between the particular timestamp I have a pattern of log: servicename operationname starttime endtime eg., servicename1 operationname1 01:11:11... (1 Reply)
Discussion started by: jacktolearn
1 Replies

9. Shell Programming and Scripting

Grep for lines in web logs

I want to find the unique url in a apache logs which got 404 error . I can do something like "cat apache.log|grep 404|awk '{print $2,$3}'|grep 404 this will give me say /foo.html 404 /foo.html 404 /foo.html 404 /bar.html 404 /cat.html 404 However my output should only find... (3 Replies)
Discussion started by: gubbu
3 Replies

10. Shell Programming and Scripting

Grep logs on the fly

Hi, We use an application that is dumping logs to a file on disk. However, this is dumping very verbosely and there is no method of turning down the logging level. We need to remove certain contents from these before they are commited to disk. Has anybody got any ideas how I can do this... (3 Replies)
Discussion started by: harperonline
3 Replies

Featured Tech Videos