Program : Logdistributor Version : 1.2 Requires : Perl and Sendmail Author : S. P. Skou Tested OS: Linux/FreeBSD Disclaimer: This works for me, if it does anything else at your place, you have probably not done something right, and it isn't my fault! ;-). Setup: I run this from my muddir/scripts to make life a bit simple for myself :), I suggest you set it up there as well. Regardless of where you put it, you still have to make some changes to the script, though most of them are Path and address related. I have listed all of the changes I can think of below, but there might be stuff you still need to lookout for that I haven't thought of. Changes to the script: Line 9: Path should fit your implementation of sendmail. Line 15: Path should point to your syslog, though this can be given on command line. Line 19: Make sure that the script can find logdistrib.conf (more about that one later) Line 72: Line 73: Line 76: Line 77: Line 84: Line 85: Line 88: Line 89: some@address should be your email address. That's about all for the changes in the script, I still might have forgotten something. On to the configuration of the logdistributor. The file logdistributor.conf is divided into 3 sections, I will try to describe each of them below. Section 1: Regular Expressions (REG-). All of your regexp's should be prefixed with REG- to mark them them as such. in the sample file you will see this line: REG-SYSERR=:: SYSERR|Warning|SCRIPT ERR: This means that when the script is run on a syslog the regexp will react on lines that look like: Tue Jan 16 12:11:12 :: SYSERR: Error Reading board etc/board.freeze Tue Jan 16 12:11:12 :: SCRIPT ERR: The Script is going to make a booboo.. Tue Jan 16 12:11:12 :: Warning: Germs may cause drowziness. It is merely a regular expression that needs to be taken care of (If you do not know what a regexp is, I can reccomend the book Mastering Regular Expressions). All files that either start with ; or # is regarded as comments. Each REG- line will generate a mail. Examples: I have included some examples that work on my mud, I cannot remember if this is the way Stock Circle logs things, but you can check them out if you like. REG-CONNECT =:: \w+ \[.*\] has connected REG-DELETE=:: \w+ \(lev \d+\) has self-deleted. REG-DT=:: .* hit death trap REG-NEWPLAYER=:: \w+ \[.*\] new player REG-BADPW=:: Bad PW: REG-HELP=:: HELP: REG-GODCMD=:: \(GC\) REG-OLC=:: \(OLC\): REG-WIZNET=:: \(:\): Section 2: Where should I mail it to? (MAIL-) If you do not wish to have the logs sent to different people, you can safely skip this point, only remember to set the MAIL-GENERIC correctly :). On the other hand, if you like me wish to have logs sent to the correct people you can configure each REG-XXXX field to have a recipient of its own (or more). if you for instance have made a REG-OLC field to match olc (See Section 1 for some examples on how I have made some of mine :). and you wish to have that one sent to someone else than the GENERIC part, you simply make a: MAIL-OLC=send.to.this@address Simple eh? :) To have it send to more than one recipient, simply add them to the line separated by a comma, just like so: MAIL-OLC=send.to.this@address,and.to.this@address Section 3: I want specific topics on my mails (SUB-) Again like in Section 2, if you do not wish definable subjects, all you need to ensure is that SUB-GENERIC is in place and looks like you want it to. This is though a bit silly since it's quite hard to sort mails that ALL have the same subject, so I guess you wish to have definable subjects as well. If you wish to have, say, definable Subject on OLC mails, you do the following: SUB-OLC=Online Creations Running the logdistributor: Once the configuration is done, you will need to run it after the mud has exited. I have the following construction around that bin/circle $FLAGS $PORT >> syslog 2>&1 ################################## scripts/logdistrib.pl And that's it.. :) When the mud crashes it should run the logdistributor :). Stuff and ToDo: No bugs known atm. ToDo: Have email address configurable by the configuration file.