PyrexKidd has asked for the wisdom of the Perl Monks concerning the following question:
my vsftpd.log file has entries that look like this:
Sun Oct 24 10:10:29 2010 [pid 2] CONNECT: Client "192.168.0.0" Sun Oct 24 10:10:29 2010 [pid 1] [user] OK LOGIN: Client "192.168.0.0" Sun Oct 24 10:10:30 2010 [pid 3] [user] FAIL UPLOAD: Client "192.168.0 +.0", "/home/path/to/file", 0.00Kbyte/sec
currently I am using the split function to parse the logs, but this is giving me irregular results as not all lines are the same, and there are a variety of different lines.{{Sun} {Oct} {24} {10:10:29} {2010}} [pid 2] {CONNECT}: Client "{192.1 +68.0.0}" {{Sun} {Oct} {24} {10:10:29} {2010}} [pid 1] {[user]} {OK LOGIN}: Clie +nt "{192.168.0.0}" {{Sun} {Oct} {24} {10:10:29} {2010}} [pid 3] {[user]} {FAIL UPLOAD}: C +lient "{192.168.0.0}", "{/path/to/file}", 0.00Kbyte/sec
foreach (<$FHIN>){ my ($dow, $month, $dom, $time, $pid, $user, $status, $client, $ip, +$file_path, $dl_speed) = split / /,$_; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Parseing FTP Logs
by aquarium (Curate) on Oct 29, 2010 at 03:57 UTC | |
|
Re: Parseing FTP Logs
by kcott (Archbishop) on Oct 29, 2010 at 00:42 UTC | |
|
Re: Parseing FTP Logs
by jethro (Monsignor) on Oct 29, 2010 at 00:52 UTC |