Solved

Command which acts on the contents of logs

Posted on 2000-05-05
3
265 Views
Last Modified: 2010-04-20
Hello All.
 I am sure I have seen this somewhere, but I cannot find it again. Is there a program that watches the end of a file as it grows (like a log file), and executes a user defined script when certain text appears in the log. If not, how can this be done.

Thanks in advance,
Nicholas Waltham
0
Comment
Question by:nwaltham
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 40

Expert Comment

by:jlevie
ID: 2782543
"tail -f some-file" watches the end of a file, continuously showing it's content as new info is added. You could pipe that to a script to watch for a specific string and it could act accordingly.
0
 
LVL 15

Accepted Solution

by:
samri earned 50 total points
ID: 2787266
nwaltham,

Just some addition (in addtion to jlevie comment :)

tail -f some-file | egrep "some pattern" | you-home-made-script.sh

Maybe you are looking for "login" in /var/adm/message

tail -f /var/adm/message | egrep "login" | logwatcher.sh

should do.  and don't forget that you need to write the "lgowatcher.sh" script yourself.

:)
0
 
LVL 2

Expert Comment

by:EatEmAndSmile
ID: 2788589
Exactly. The "cut" command will provide the filter to grab the interesting part of the text you need.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Network Interface Card (NIC) bonding, also known as link aggregation, NIC teaming and trunking, is an important concept to understand and implement in any environment where high availability is of concern. Using this feature, a server administrator …
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

724 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question