irctail – track a file on an irc channel

Irctail is a small program I wrote to keep track of log files on various servers through an IRC channel.

It will track stdin or a given file (like tail -f), and send the lines to an IRC channel.

There are options to specify irc server, channel, nick and some more. An example:

irctail -c channel -n nick irc.example.com /var/log/messages

It is possible to specify a regular expression where a prefix match on the input line will be removed before the line is sent to the irc channel. It can be used to remove timestamps and other stuff that might clutter an irc channel too much.

A more real life example.

I’m managing a fairly large network with private users, and sometimes somebody installs a wifi network so the dhcp server is exposed on the entire network. This will cause other users problems as they get dhcp responses from the wrong dhcp server.

To monitor the situation I run these commands on a network management server:

tcpdump -lten -i eth5 udp and src port 67 and dst port 68 and not net 10 >dhcp-servers.out &
irctail -c staff -n dhcp irc.example.com dhcp-servers.out &

I could just have piped the output of tcpdump and left out the output file but I’d like to keep it for later reference.

Download the irctail source code

Full manual below the fold.

Manual for irctail


NAME

irctail – Track a file on an IRC channel

SYNOPSIS

irctail [ -c channel ] <[ -n nick ] [ -p regex ] host [ file ]

irctail [ –man | –help ]

OPTIONS

–channel chan
Join the given IRC channel for the output. The channel can be given
without the leading # which will be added automatically.
–nick name
Use the give nick on the IRC channel.
–prefix regex
Remove matches for regex before the line is sent to the IRC server.
The default matches the date and time in the format used by syslog(8).

DESCRIPTION

irctail will read the given input file or standard input and send
the data line by line to an IRC channel on host.

It is useful when keeping an eye on alerts and other messages from
many different sources.

REQUIREMENTS

The following modules are needed to use irctail:

NET::IRC
File::Tail
Time::HiRes

BUGS

irctail doesn’t handle being kicked or disconnected.

irctail doesn’t reconnect automatically.

irctail can’t connect to non-standard ports.

irctail tends to be disconnected for excessive flood if too much data is sent. It is better used for less copious data.

Tags: , , ,

Leave a Reply

You must be logged in to post a comment.