?
Solved

Need a script to search in the logs

Posted on 2009-04-13
11
Medium Priority
?
265 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
Get MongoDB database support online, now!

At Percona’s web store you can order your MongoDB database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card. Handle your MongoDB database support now!

 

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

Give Your Engineering Team a Productivity Boost

Learn why container technology is so powerful and how it can provide your team with productivity gains and other benefits.

Question has a verified solution.

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

I hope you'll find this tutorial useful and interesting. So let's try to extend Tcl with a new package.  For anyone more deeply interested please check out the book "Practical Programming in Tcl and Tk". It's really one of the best written books abo…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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 fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
Suggested Courses

752 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