Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^4: adding wtmp script into logwatch

by hedkandi (Initiate)
on Dec 01, 2011 at 02:27 UTC ( [id://940994]=note: print w/replies, xml ) Need Help??


in reply to Re^3: adding wtmp script into logwatch
in thread adding wtmp script into logwatch

Hi Sinistral Sorry, Im asking you alot of questions here. So anyways I corrected the "+" signs and it looks like this now:
#!/usr/bin/perl @type = ( "Empty", "Run Lvl", "Boot", "New Time", "Old Time", "Init", "Login", "Normal", "Term", "Account" ); $recs = ""; while (<>) { $recs .= $_; } foreach ( split( /(.{384})/s, $recs ) ) { next if length($_) == 0 ; my ( $type, $pid, $line, $inittab, $user, $host, $t1, $t2, $t3, $t +4, $t5 ) = $_ =~ /(.{4})(.{4})(.{32})(.{4})(.{32})(.{256})(.{4})(.{4})(.{4} +)(.{4})(.{4})/s; if ( defined $line && $line =~ /\w/ ) { $line =~ s/\ x00+//g; $host =~ s/\x00+//g; $user =~ s/\x00+//g; printf( "%s %-8s %-12s %10s %-45s \n", scalar( gmtime( unpack( "I4", $t3 ) ) ), $type[ unpack( " I4", $type ) ], $user, $line, $host ); } } printf "\n" < /var/log/wtmp
I added the wtmp directory so the script would call the logs from wtmp...but I am wrong again because the new error I see is this:
--------------------- WTMP logs Begin ------------------------ Warning: Use of "log" without parentheses is ambiguous at /usr/share/ +logwatch/scripts/services/my-report line 32. syntax error at /usr/share/logwatch/scripts/services/my-report line 3 +2, near "/var/log" Search pattern not terminated at /usr/share/logwatch/scripts/services +/my-report line 32. ---------------------- WTMP logs End -------------------------
Thank you again for correcting the script, i'm really really grateful for that!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://940994]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (6)
As of 2024-04-23 18:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found