--- error_log_spread.pl	2000-10-14 21:08:04.000000000 -0700
+++ /usr/local/bin/error_log_spread.pl	2007-08-23 19:27:24.000000000 -0700
@@ -18,16 +18,16 @@
 $| = 1;
 
 # Read in options
-getopts('dg:hs:', \%opts);
+getopts('adg:hs:', \%opts);
 $debug = $opts{d};
 &usage() unless ($group = $opts{g});
 $hosttoggle = $opts{h};
-$spreaddaemon = ($opts{s}?$opts{s}:3333);
+$spreaddaemon = ($opts{'s'}?$opts{'s'}:3333);
 
 
 # Set spread connection params
 #$hostname = `hostname`;
-chomp ($hostname = `hostname`) ;
+chomp ($hostname = $opts{a} ? `hostname -s` : `hostname`) ;
 $args{'spread_name'} = $spreaddaemon;
 $args{'private_name'} = "$$-$hostname";
 $args{'priority'} = 0;
@@ -35,18 +35,16 @@
 
 # Connect to daemon
 print "Trying to connect to spread...\n" if $debug;
-($mbox, $privategroup) = Spread::connect(
-        \%args
-        );
+($mbox, $privategroup) = Spread::connect( \%args );
 print "$sperrno\n" unless (defined($mbox) && $debug);
 
 #Logging loop
 while(<STDIN>){
-chomp;
-print "MESSAGE $_\n";
+    # chomp; # spreadlogd doesn't replace this, so don't throw it away.
+    print "MESSAGE $_";
 if(($ret = Spread::multicast($mbox,
                              RELIABLE_MESS, $group, 0,
-                             ($hosttoggle?$hostname." ".$_:$_)))>0) {
+                                  ($hosttoggle ? "$hostname $_" : $_))) > 0) {
   print STDERR "Successfully multicasted $ret bytes to [$group]\n" if $debug;
 } else {
   print STDERR "Failed multicast $_ to $group: $sperrno\n" if $debug;
@@ -54,7 +52,7 @@
 }
 
 sub usage(){
-        print STDERR "Usage:  Logger -g group [-h] [-s daemon] [-d]\n";
+    print STDERR "Usage:  Logger -g group [-h] [-a] [-s daemon] [-d]\n";
         exit 0;
 }
 
