this is the format of the log file in my system
the path of this logs file in on for example
/dellxmax/application/log
what i want to do is
make script
give me this output
----------------------------------------------------------------------
File Name | status | date
----------------------------------------------------------------------
xxxxx_xxx_xxxx_xxxxx_09_10_2009_170457.log | success | 22_10_2009
xxxx_xxx_2_0_09_10_2009_163834.log | success | 22_10_2009
xxx_xxxxxxxxx_25_10_2009_045020.log | success | 22_10_2009
xxx_xxxxxxx_08_11_2009_055728.log | success | 22_10_2009
in this report i want the arrange ascending (the last file modified is the last one in this report)
for the status i want this script search for Successfully in the file
founded give me successfully
if it doesn't give me fail
try this let me know if it helps, this is assuming you have the "stat" installed
I did this on a CentOS machine. If I understood your post this is what you are looking for just need to tweak it if needed but now you might have the idea.
this is the output of the script
1- i appreciate your help very very thank you
2- i need some edit for the output
all of this log for the same job run if dufferient days i want to replace 2009-11-11 with the date of the log for example
when you run this command ls -ltr all file sorted -l long list format -t Sorts by time stamp (latest first) -r Reverses the order of sort
So when I do this command the last created depending on time stamp will be the last file in the list I want this script have the same concept of the command
the script search for successfully else put failed
i want to enter another condition and the first condition also running the secand condition is search for dellxmax in the file found write done in the status not found write ndone in the status
totally i would like to thanks you very much for this script
your log files has to be consistent since this will grab the last 21 characters from the log file name, btw, if you want to remove the counta you could and you won't get the line number on each output.
if you need further editing to the script, try doing it yourself and post it here and I will do my best to help you out
But online you will find many tutorials. You can also browse through unix.com and look at people's problems and see the developed solution and try to analise it.
Hello All,
I want to write a script to monitor my product logs from /var/log/messages and send notifications without using "tail -f" command.Please suggest alternatives and any other tools for monitoring and alerting.
Thank You (1 Reply)
Hi,
I need to grep a pattern in the log file of a process and send a mail if pattern found.But I am not able to figure out how do I detect when the process comes UP,it is started several times a day and each time it is started I need to perform this action. Please suggest something. (3 Replies)
is there a way to efficiently monitor logfiles that do not have a date or time format? i have several logs on several different servers that need to be monitored. but i realized writing a script for this would be very complex and time consuming giving the variety of things i need to check for i.e.... (2 Replies)
Hi,
I need to amend an existing ksh script so that it runs a process (stop weblogic) and in parallel needs to monitor a log file (startup.log) in the background for a certain string (e.g. unable to stop weblogic). If the string appears in the log i need to kill the stop weblogic process.
... (5 Replies)
Hi,
Have written a script to monitor linux non standard log file based on line numbers, so each check store $otalinenum ..
then in next check after 10 minutes it compre the current_total_line_num > last_total_line_num then it will parse the log file from last_total_line_num to... (0 Replies)
AM in need of some plugin/script that can monitor HP-UX file "/var/opt/resmon/log/event.log" .
Have written a scrip in sh shell that is working fine for syslog.log and mail.log as having standard format, have interrogated that to Nagios and is working as I required .
But same script failed to... (3 Replies)
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
Write an automated shell program(s) that can create, monitor the log files and report the issues for matching... (0 Replies)
Hello,
I want something like this
tail -f /a/b/c/*.log | grep -i "STRING1|STRING2 " > a.txt
I want to check all the log files in a particular directory then grep if any of the log files have "STRING1" and "STRING2" string and then have to send email to the group.
Platform is HP-UX
it... (8 Replies)
hi All,
how to find a pattern in the log file & display the above and below line
for example in the log file, i have many lines, whenever i search for "Category" it should display the above line with only few parameter like i want only the location name & department name
Thu Jul 02 11:05:23... (2 Replies)
Hi All,
I have a question and hope someone will have an answer to that. I'm looking for a way to monitor log files being generated on a windows machine for some specified string and if its occurrence is found, raise an alarm though email. The log file size keeps on increasing and after a... (2 Replies)