| View previous topic :: View next topic |
| Author |
Message |
vanbee Voice
Joined: 01 Sep 2005 Posts: 3
|
Posted: Thu Sep 01, 2005 11:16 am Post subject: a "tail -f" output script |
|
|
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
Thanks in advance,
Laurent |
|
| Back to top |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Thu Sep 01, 2005 1:00 pm Post subject: |
|
|
not too much to share:
| Code: |
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]"}
|
|
|
| Back to top |
|
 |
vanbee Voice
Joined: 01 Sep 2005 Posts: 3
|
Posted: Fri Sep 02, 2005 4:58 am Post subject: :) |
|
|
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 |
|
| Back to top |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Fri Sep 02, 2005 5:33 am Post subject: |
|
|
this minimalistic script works fine for me
try with different file, appending to it with echo 'some text' >>file.txt |
|
| Back to top |
|
 |
vanbee Voice
Joined: 01 Sep 2005 Posts: 3
|
Posted: Sat Sep 03, 2005 6:07 am Post subject: :) |
|
|
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  |
|
| Back to top |
|
 |
|