This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

a "tail -f" output script

Old posts that have not been replied to for several years.
Locked
v
vanbee
Voice
Posts: 3
Joined: Thu Sep 01, 2005 10:55 am

a "tail -f" output script

Post by vanbee »

Hi,

I searched the web and the forum without success.
I'm looking for a script that parse the output of my gateway's logfiles (for example syslog or auth.log) and off course print it on a private channel (which is a internal one).
I'd like to do it myself but I know nearly nothing in tcl and right now I haven't the time to do such things.

Maybe one of you, got a script like that and can share it with the rest of the world .. and me :D

Thanks in advance,
Laurent
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

not too much to share:

Code: Select all

set f [open "|tail -f /var/log/messages"]
fconfigure $f -blocking 0 -buffering line
fileevent $f readable [list foo $f]
proc foo {f} {puthelp "privmsg #chan :[gets $f]"}
v
vanbee
Voice
Posts: 3
Joined: Thu Sep 01, 2005 10:55 am

:)

Post by vanbee »

Hi,

Thanks for the quick answer! I just tried your script but I have a problem.
In fact, the egg don't stop sending blank lines every 2 seconds even if there is something something new in my log file.
I just changed the path to correspond to my syslog. But I'm sure I'm doing something wrong, can you help me ?

Thanks :)
Laurent
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

this minimalistic script works fine for me

try with different file, appending to it with echo 'some text' >>file.txt
v
vanbee
Voice
Posts: 3
Joined: Thu Sep 01, 2005 10:55 am

:)

Post by vanbee »

I have tried it with another file and indeed it works fine. I can't figure out why it keeps sending blank lines for my syslog, I will try to get the informations I want via another file.
Anyway thanks for the little script :D
Locked