[Solved] Fetching logs of last few days from logfile
Hi All,
I have a requirement to fetch logs of last 'N' days.
I am trying the following command which is working fine if it finds the date of that day in logfile.
this is being used to fetch 'N'th day's date
and
is being used to fetch the records from log file.
like if last 'N' day's date is 2012 Jun 17
and this date is present in file then it gives out the record from 2012 Jun 17 to NOW.
But if last 'N' day's date is 2012 Jun 17 and it is not present in log file then its giving the blank response , though there are records available for date 2012 Jun 16.
Please help me!
Thanks in advance!
Regards,
KD
Moderator's Comments:
Please view this code tag video for how to use code tags when posting code and data.
Thanks but that is worked in cse if we kknow the exact date or timestamp.
Problem is that if that timestamo or date is not present in log file iit is giving whole file where aas it should give response as per my first post.
Thanks but that is worked in cse if we kknow the exact date or timestamp.
Problem is that if that timestamo or date is not present in log file iit is giving whole file where aas it should give response as per my first post.
This should work, you don't have to give the exact timestamp:
Dear Experts,
I need some help to get the time stamps from the Unix logs. Basically I am want to analyze which step is taking more time. Please give me some inputs. Thanks a lot for your help.
I have got different codes for each for phase as we can see in the logs
00002 – UPDT Starting... (5 Replies)
As i am working in unix environment so i have an logs that is created by my application at the following location that is
/opt/app/glac/current/servers/ops/logs
inside the logs directory there are different kinds of logs(that is the file having extension as .log ) have been created... (1 Reply)
Hi Team,
Have to write a shell script to pick only 1 hr logs from the generated logfile and send it to other logfile.
Thanks & Regards,
Indu (3 Replies)
I have crontab job a tar file to a directory ( tar -cvf /tmp/backup/or.`date +%m%d%y`. /ora/db/* ) , it will do it every day . Now I don't want to keep too much files , I just want to keep the file for 90 days , can advise if I want to remove the backup file which are elder than 90 days , can... (1 Reply)
i am using HP-UX OS......
delete logs older than 60 days
find -mtime +60 | grep -i '.*log' | xargs rm
-mtime is nt available in HP-UX, pls tell me other option ? (2 Replies)
I want to write a shell script that deletes all log files in a directory that are older than 30 days except for 3 files:
I am using the following command:
find /tmp/logs -name "*.log" -mtime +30 -exec rm -f {} \;But this command deletes all the log files.
How can i modify this script that... (5 Replies)
How I can get the logs that are getting stored in specific location in unix server
through an Apache web server installed in unix server?
Requirement is to access the logs through the URL in windows browser without any access. (1 Reply)