Solved

Need a script to search in the logs

Posted on 2009-04-13
11
262 Views
Last Modified: 2013-12-26
. Search in the logs for the IP.Adresses
2. if found take the 'connected' or ' disconnected' status
3. create output <IP- Adress> - <status>
Take care that the script is searcing in all logs available when it is started the first time, because only connection status changes only written in this logs.
The following time the script should take the new logs and the last information written by the script to create new status update.
The script should be stated via crontab each 5 minutes
0
Comment
Question by:ratnaprasad123
[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
  • 5
  • 3
11 Comments
 
LVL 40

Expert Comment

by:omarfarid
ID: 24135075
can you provide sample logs?
0
 

Author Comment

by:ratnaprasad123
ID: 24135110
Attaching the code here
0
 

Author Comment

by:ratnaprasad123
ID: 24135124
Attaching the log file
connection-ipdp01-0-63.log
0
Independent Software Vendors: 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!

 

Author Comment

by:ratnaprasad123
ID: 24135252
Hi Do you need any more info let me know.
0
 
LVL 84

Expert Comment

by:ozo
ID: 24135279
Do you want the IP address from the LOCL, REM, or ID column?
0
 

Author Comment

by:ratnaprasad123
ID: 24135350
take it as LOCL
Thanks,
0
 
LVL 84

Expert Comment

by:ozo
ID: 24135455
perl -ane '$i{$F[4]}=[@F[0,2]] unless $i{$F[4]} && $i{$F[4]}[0] gt $F[0]; END{print "$_ - $i{$_}[1]\n" for keys %i}' *.log
0
 

Author Comment

by:ratnaprasad123
ID: 24135509
Do you have any other way than perl......Sorry  i am little weak in perl
0
 
LVL 84

Accepted Solution

by:
ozo earned 500 total points
ID: 24135618
awk '{if( !t[$5]|| t[$5] < $1 ){ t[$5] = $1; s[$5]=$3 }}END{ for( i in s){ print i,"-",s[i]; }}' *.log
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Background Still having to process all these year-end "csv" files received from all these sources (including Government entities), sometimes we have the need to examine the contents due to data error, etc... As a "Unix" shop, our only readily …
In this post we will learn different types of Android Layout and some basics of an Android App.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

690 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