source: server/fedora/config/etc/syslog-ng/d_zroot.pl @ 664

Last change on this file since 664 was 664, checked in by andersk, 14 years ago
-c scripts -> -c scripts-auto.
  • Property svn:executable set to *
File size: 605 bytes
Line 
1#!/usr/bin/perl
2
3use strict;
4use warnings;
5use Sys::Hostname;
6
7sub sendmsg {
8    my ($message) = @_;
9    open(ZWRITE, "|-", qw|/usr/bin/zwrite -d -c scripts-auto|, '-i', 'root.'.hostname, '-s', hostname) or die "Couldn't open zwrite";
10    print ZWRITE $message;
11    close(ZWRITE);
12}
13
14my $last;
15
16while (my $message = <>) {
17    chomp $message;
18    $message =~ s/^(.*?): //;
19    if ($message =~ m|Accepted (\S+) for (\S+)|) {
20        my $send = $message;
21        if ($1 eq "gssapi-with-mic") {
22            $send = $last."\n".$send;
23        }
24        if ($2 eq "root" or $2 eq "logview") {
25            sendmsg($send);
26        }
27    }
28    $last = $message;
29}
Note: See TracBrowser for help on using the repository browser.