topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Thursday March 28, 2024, 4:50 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: IDEA: log searcher in real-time  (Read 5175 times)

paulo_andre

  • Participant
  • Joined in 2008
  • *
  • default avatar
  • Posts: 3
    • View Profile
    • Donate to Member
IDEA: log searcher in real-time
« on: January 11, 2008, 03:55 AM »
Hi! I just found this site and I could use a little help on automating some command I use a lot.
So here's what I do:
1-program something in a unix machine
2-run the program in several unix machines
3-watch the log for all programs in that unix machine
4-If my program aborted, it will write in the log, otherwise it will write that it completed well.

So I need to watch several logs in real-time (using tail -f logfile) and search for a line with my program in it.
Is it too hard to code some windows app that automatically connects (via telnet or ssh, it can even use putty) to a configurable server, login with a configurable username and password, perform a configurable command (usually always tail -f something, but if it could be a little more flexible...) and then watch the output for a configurable string. If that string is found, play a sound to warn the user and display the line in the screen (no other output needs to be displayed). This to be done with several logs at the same time.
Is this simple enough to be considered a coding snack?
I would do it myself, but the "play sound" part is really important and I only code in unix command line...

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,896
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: IDEA: log searcher in real-time
« Reply #1 on: January 11, 2008, 08:09 PM »
i'm pretty sure a program like this exists.. but i can't remember the name at the moment.

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,277
    • View Profile
    • Donate to Member
Re: IDEA: log searcher in real-time
« Reply #2 on: January 11, 2008, 09:00 PM »
are you looking for something like this: Tail4Win?

visitor.gifIDEA: log searcher in real-time

http://www.downloadj...re/134644/index.html

paulo_andre

  • Participant
  • Joined in 2008
  • *
  • default avatar
  • Posts: 3
    • View Profile
    • Donate to Member
Re: IDEA: log searcher in real-time
« Reply #3 on: January 12, 2008, 05:50 PM »
nope, that's not what I'm looking for, not even close. Tail4Win can monitor a local file for changes and highlight keywords, what I want is to monitor a remote file over a telnet/ssh connection (or simply monitor the output of that connection after a specified command is entered) and launch a sound when a keyword appears in that file. Still, if you know a program that already does this I'm very interested.

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,277
    • View Profile
    • Donate to Member
Re: IDEA: log searcher in real-time
« Reply #4 on: January 13, 2008, 04:20 AM »
hmm.. i must have misunderstood the question but just hang in there.. once a regular terminal user spots this, you'll be in good hands.. :)

Gothi[c]

  • DC Server Admin
  • Charter Honorary Member
  • Joined in 2006
  • ***
  • Posts: 873
    • View Profile
    • linkerror
    • Donate to Member
Re: IDEA: log searcher in real-time
« Reply #5 on: January 13, 2008, 06:27 AM »
The xtail utility can follow changes to (log)files in real time (and even do some color highlighting if you want). Now apply some UNIX mentality and COMBINE that tool with another to provide the network functionality. Eg:

xtail + sshfs

(sshfs lets you mount the filesystem on a remote ssh connection, and thus allows you to use it as a local one, with no additional requirements on the other end.)

xtail + remote syslog

...

[ just run the above in a bash script in cygwin on windows, get a commandline utility for playing sound files, and incorporate that in your script as well. ]

« Last Edit: January 13, 2008, 06:38 AM by Gothi[c] »

paulo_andre

  • Participant
  • Joined in 2008
  • *
  • default avatar
  • Posts: 3
    • View Profile
    • Donate to Member
Re: IDEA: log searcher in real-time
« Reply #6 on: January 14, 2008, 12:43 AM »
looks good, but here's another problem... I have one server with no ssh connection, it must be a telnet connection and sshfs only supports ssh. I can't install anything on the server (except my own programs that are needed, after being reviewed), so it's still no good. Also the sound was quite important, it would allow me to do other things while waiting for the log and as soon as I heard it I knew I had to check.
Another "problem" is that sshfs is linux-only, to run it in Windows I'll have to install and use cygwin. This is a little more complicated that what I wanted.
However, this solves some problems on the other servers, so I'll test it and start using it for now.