Sponsored Content
Top Forums Shell Programming and Scripting Continiously monitor the log file Post 302568279 by arumon on Thursday 27th of October 2011 12:54:34 AM
Old 10-27-2011
Continiously monitor the log file

Hi Friends,

I am trying to write a script which continiously monitor one specific error message from a log file. This script should continiously monitor the file for the error and send out the email when detect the error message. I tried the below command but fails. Please help me.
Code:
tail -f /var/log/messages | grep "file not found" | mail -s "error found" arumon@testing.com


Regards,
Arumon

Last edited by Franklin52; 10-27-2011 at 03:22 AM.. Reason: Please use code tags for code and data samples, thank you
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bash tail monitor log file

Hi there, I have a problem here that involves bash script since I was noob in that field. Recently, I have to monitor data involve in logs so I just run command tail -f for the monitoring. The logs was generate every hour so I need to quickly change my logs every time the new hour hits according... (2 Replies)
Discussion started by: kriezo
2 Replies

2. Shell Programming and Scripting

Monitor log file and execute command

I would like to monitor a log file using a shell script and as soon as a line with a certain string in it appears I would like to run a program. I have been playing around with doing this using tail -f, but cannot get it to work. I found something similar here:... (1 Reply)
Discussion started by: danielsbrewer
1 Replies

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

4. Shell Programming and Scripting

Monitor dynamic log file for a particular Error

Hi Folks, I need help in creating a script to monitor a continuously updating log for one particular error. If the the script finds the error it should send out an email. Thanks for all ur help (2 Replies)
Discussion started by: a12ka4
2 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

How to monitor log file for a Error and generate the e-mail ( Please help)

This is my log file and this is live log. Any abnormal error other than following I need to generate the email. Log path : /DER/app/admin/ABC/bdump/erg.log Current log# 2 seq# 103046 mem# 0: /ora2/oradata/ABC/redo02a.log Current log# 2 seq# 103046 mem# 1:... (7 Replies)
Discussion started by: hishanms
7 Replies

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

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

9. Shell Programming and Scripting

prepend timestamp to continiously updating log file

Hi, I have a process which outputs to a log. Below is the code snippet: process &> $LOGFILE& The log file keeps on updating whenever a transaction is processed. The log file has a time stamp added so every time I kill the process and start the process a new log file is... (4 Replies)
Discussion started by: rajkumarme_1
4 Replies

10. UNIX for Beginners Questions & Answers

How do I add a log file path to a vi file to monitor all the changes made to the file?

I'm curious to know how do I add an empty log file (test1.log) to an existing text file to monitor all the changes made to a.txt. Is this expression export PATH=$PATH:/home/test1.log right to be added to the text file a.txt? (5 Replies)
Discussion started by: TestKing
5 Replies
LAMSON(1)																 LAMSON(1)

NAME
Lamson - Lamson is a modern Pythonic mail server built like a web application server. SYNOPSIS
lamson <action> [options] DESCRIPTION
lamson is a pure Python SMTP server designed to create robust and complex mail applications in the style of modern web frameworks such as Django. Unlike traditional SMTP servers like Postfix or Sendmail, Lamson has all the features of a web application stack (ORM, templates, routing, handlers, state machines, Python) without needing to configure alias files, run newaliases, or juggle tons of tiny fragile pro- cesses. Lamson also plays well with other web frameworks and Python libraries. ACTIONS
log [-port PORT] [-host HOST] [-pid PIDFILE] [-chroot True|False] [-chdir DIR] [-umask UMASK] [-uid UID] [-gid GID] [-FORCE True|False] Runs a logging only server on the given hosts and port. It logs each message it receives and also stores it to the run/queue so that you can make sure it was received in testing. lamson log -port 8825 -host 127.0.0.1 -pid ./run/log.pid -chroot False -chdir "." -umask False -uid False -gid False -FORCE False If you specify a uid/gid then this means you want to first change to root, set everything up, and then drop to that UID/GID combina- tion. This is typically so you can bind to port 25 and then become "safe" to continue operating as a non-root user. If you give one or the other, this it will just change to that uid or gid without doing the priv drop operation. send [-port PORT] [-host HOST] [-debug 0|1] [-sender EMAIL] [-to EMAIL] [-subject SUBJECT] [-body BODY] [-attach FILENAME] Sends an email to someone as a test message. See the sendmail command for a sendmail replacement. lamson send -port 8825 -host 127.0.0.1 -debug 1 -sender EMAIL -to EMAIL -subject STR -body STR -attach False' sendmail [-port PORT] [-host HOST] [-debug 0|1] -- [RECIPIENTS] Used as a testing sendmail replacement for use in programs like mutt as an MTA. It reads the email to send on the stdin and then delivers it based on the port and host settings. lamson sendmail -port 8825 -host 127.0.0.1 -debug 0 -- [recipients] start [-pid PIDFILE] [-FORCE True|False] [-chroot True|False] [-chdir DIR] [-umask UMASK] [-uid UID] [-gid GID] [-boot BOOTMODULE] Runs a lamson server out of the given directory. lamson start -pid ./run/smtp.pid -FORCE False -chroot False -chdir "." -umask False -uid False -gid False -boot config.boot stop [-pid PIDFILE] [-KILL True|False] [-ALL DIR] Stops a running lamson server. Give -KILL True to have it stopped violently. The PID file is removed after the signal is sent. Give -ALL the name of a run directory and it will stop all pid files it finds there. lamson stop -pid ./run/smtp.pid -KILL False -ALL False restart [-pid PIDFILE] [-FORCE True|False] [-chroot True|False] [-chdir DIR] [-umask UMASK] [-uid UID] [-gid GID] [-boot CONFIG] [-KILL True|False] [-ALL DIR] Simply attempts a stop and then a start command. All options for both apply to restart. status [-pid PIDFILE] Prints out status information about lamson useful for finding out if it's running and where. lamson status -pid ./run/smtp.pid queue [-pop|-get|-remove|-count|-clear|-keys] [-name QUEUE] Let's you do most of the operations available to a queue. lamson queue (-pop | -get | -remove | -count | -clear | -keys) -name run/queue routes [-path PATH] -- [CONFIG] [-test EMAIL] Prints out valuable information about an application's routing configuration after everything is loaded and ready to go. Helps debug problems with messages not getting to your handlers. Path has the search paths you want separated by a ':' character, and it's added to the sys.path. lamson routes -path $PWD -- config.testing -test "" It defaults to running your config.testing to load the routes. If you want it to run the config.boot then give that instead: lamson routes -- config.boot You can also test a potential target by doing -test EMAIL. gen [-project NAME] Generates various useful things for you to get you started. lamson gen -project STR spell [-language LANG] -- [FILES] Runs the PyEnchant spell checker on the given file. Use this to train the spell checker for unit test runs when new words show up. lamson spell -langauge en_US -- [files] It will run interactively and if you perform an edit on the file it will save your changes back to the file and make a backup named with .bak. web [-basedir DIR] [-port PORT] [-host HOST] Starts a very simple files only web server for easy testing of applications that need to make some HTML files as the result of their operation. If you need more than this then use a real web server. lamson web -basedir "." -port 8888 -host '127.0.0.1' This command doesn't exit so you can view the logs it prints out. cleanse [-input MAILBOX] [-output MAILBOX] Uses Lamson mail cleansing and canonicalization system to take an input maildir (or mbox) and replicate the email over into another maildir. It's used mostly for testing and cleaning. blast [-input MAILBOX] [-port PORT] [-host HOST] [-debug 0|1] Given a maildir, this command will go through each email and blast it at your server. It does nothing to the message, so it will be real messages hitting your server, not cleansed ones. version Prints the version of Lamson, the reporitory revision, and the file it came from. help [-for CMD] Prints out help for the commands. lamson help You can get help for one command with: lamson help -for STR SEE ALSO
Full documentation for lamson can be found at http://lamsonproject.org BUGS
Please report bugs at https://bugs.launchpad.net/lamson AUTHOR
This manual page was written by David Watson <david@kutoken.com> 25 August 2009 LAMSON(1)
All times are GMT -4. The time now is 05:28 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy