Re: [logs] Trial SELP client implementation

From: Bennett Todd (betat_private)
Date: Fri Jan 10 2003 - 05:12:23 PST

  • Next message: Bennett Todd: "Re: [logs] Trial SELP client implementation"

    2003-01-09T19:06:20 Mikael Olsson:
    > Bennett Todd wrote:
    > >     my $timestamp = strftime("%Y-%m-%dT%H:%M:%S%z", localtime(time));
    > 
    > Rong. The "z" should be "Z", and, if so, it describes GMT, so
    > you shouldn't be using localtime().
    
    Actually, I had it almost right; "%z" interpolates the local
    timezone as a numeric offset [+-]HHMM. What I missed is that RFC
    3339 (and so SELP) wants that offset in [+-]HH:MM, i.e. I was
    missing the ":".
    
    @@ -45,11 +45,13 @@
     
     if (@ARGV) {
         my $timestamp = strftime("%Y-%m-%dT%H:%M:%S%z", localtime(time));
    +    $timestamp =~ s/(\d\d$)/:$1/;
         $sock->print("<$prio>$timestamp $host @ARGV\r\n");
     } else {
         while (<>) {
         	chomp;
     	my $timestamp = strftime("%Y-%m-%dT%H:%M:%S%z", localtime(time));
    +	$timestamp =~ s/(\d\d$)/:$1/;
     	$sock->print("<$prio>$timestamp $host $_\r\n");
         }
     }
    
    should fix it up.
    
    > /Mike, always glad to audit other people's code :)
    
    The attention and assistence is appreciated!
    
    -Bennett
    
    
    

    _______________________________________________ LogAnalysis mailing list LogAnalysisat_private http://lists.shmoo.com/mailman/listinfo/loganalysis



    This archive was generated by hypermail 2b30 : Fri Jan 10 2003 - 11:43:36 PST