Sponsored Content
Top Forums Shell Programming and Scripting Need help for this monitor log script Post 302370424 by sysrenan on Wednesday 11th of November 2009 10:08:57 AM
Old 11-11-2009
try this:

Code:
#!/bin/bash

counta=1
CMD="ls -tr /dellxmax/application/log/"

for file in `$CMD`
do
      DC=$(echo $file | awk '{ print substr( $0, length($0) - 20, length($0) ) }' | sed 's/.log//g' | sed 's/_/./g')
        STATUSLOG=$(grep 'success' $file)

        if [ "$?" -eq 0 ]
        then
                ST="success";
        else
                ST="failed";
        fi

        echo "$counta) $file | $ST | $DC";
        counta=`expr $counta + 1`;
done

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

let me know if this helped
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Log monitor script

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)
Discussion started by: er_ashu
2 Replies

2. Shell Programming and Scripting

Script to monitor the pattern in the log file

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)
Discussion started by: rithick256
2 Replies

3. Shell Programming and Scripting

monitor log files

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)
Discussion started by: RTY
8 Replies

4. Homework & Coursework Questions

shell script that can create, monitor the log files and report the issues for matching pattern

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)
Discussion started by: itian2010
0 Replies

5. HP-UX

Script to monitor /var/opt/resmon/log/event.log file

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)
Discussion started by: Shirishlnx
3 Replies

6. Shell Programming and Scripting

Script to monitor log file

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)
Discussion started by: Shirishlnx
0 Replies

7. Shell Programming and Scripting

Monitor log file

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)
Discussion started by: dholmaster
5 Replies

8. Shell Programming and Scripting

Monitor log entries in log files with no Date format? - Efficient logcheck?

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)
Discussion started by: SkySmart
2 Replies

9. Shell Programming and Scripting

Monitor log when Process comes UP

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)
Discussion started by: vishal bhargava
3 Replies

10. Shell Programming and Scripting

Script to monitor /var/log/messages

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)
Discussion started by: Cva2568
1 Replies
grokevt-addlog(1)														 grokevt-addlog(1)

NAME
grokevt-addlog - A tool for adding a raw event log to an existing GrokEVT database. SYNOPSIS
grokevt-addlog database-dir evt-file new-type base-type .SH DESCRIPTION grokevt-addlog takes a raw event log (.evt file) and adds it to a pre-built database generated by grokevt-builddb(1). This new log file will be set up to use the message templates of another log, as deter- mined by the user. This tool is primarily useful for processing deleted logs and log fragments found on a system. While it is possible to use the database generated from one system with the logs of another, this is not recommended for investigations unless no alternatives exist. ARGUMENTS
grokevt-addlog uses the following arguments: database-dir The base directory for the database generated previously by grokevt-builddb(1). evt-file The file to be added to the database. new-type The new log type/name that evt-file will take on. This is the name that will need to be used later with grokevt-parselog(1) to access the new log. This type must not already exist in the database. base-type The existing log type that this new log will be based on. The message templates from this type will be used with the new log when parsing. This type must exist in the current database. BUGS
Probably several. This particular script has not been extensively tested. CREDITS
Written by Timothy D. Morgan. Copyright (C) 2006-2007 Timothy D. Morgan LICENSE
Please see the file "LICENSE" included with this software distribution. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MER- CHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License version 2 for more details. SEE ALSO
grokevt(7) grokevt-builddb(1) grokevt-dumpmsgs(1) grokevt-findlogs(1) grokevt-parselog(1) grokevt-ripdll(1) File Conversion Utilities 20 March 2008 grokevt-addlog(1)
All times are GMT -4. The time now is 03:02 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy