Leser: 13
1
2
3
4
5
6
2009-04-16 13:13:31 - 141.30.***.*** - SID:991bc2f453756b37348835ec3d4d968b [NOTE] user_login - uid #1
2009-04-16 13:13:31 - 141.30.***.*** - SID:991bc2f453756b37348835ec3d4d968b [INFO] user_login_detail - nick chr
2009-04-16 13:13:39 - 141.30.***.*** - SID:991bc2f453756b37348835ec3d4d968b [NOTE] admin_login
2009-04-16 13:13:50 - 141.30.***.*** - SID:991bc2f453756b37348835ec3d4d968b [NOTE] admin_login_successful - uid #1
2009-04-16 13:13:50 - 141.30.***.*** - SID:991bc2f453756b37348835ec3d4d968b [NOTE] admin_home
2009-04-16 13:13:53 - 141.30.***.*** - SID:991bc2f453756b37348835ec3d4d968b [NOTE] admin_tools
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
"log_data" : {
"2009-04-16" : {
"991bc2f453756b37348835ec3d4d968b" : [
{
"msg" : "user_login - uid #1",
"time" : "13:13:31",
"ip" : "141.30.***.***",
"type" : "NOTE"
},
{
"msg" : "user_login_detail - nick chr",
"time" : "13:13:31",
"ip" : "141.30.***.***",
"type" : "INFO"
},
{
"msg" : "admin_login",
"time" : "13:13:39",
"ip" : "141.30.***.***",
"type" : "NOTE"
},
{
"msg" : "admin_login_successful - uid #1",
"time" : "13:13:50",
"ip" : "141.30.***.***",
"type" : "NOTE"
},
{
"msg" : "admin_home",
"time" : "13:13:50",
"ip" : "141.30.***.***",
"type" : "NOTE"
},
{
"msg" : "admin_tools",
"time" : "13:13:53",
"ip" : "141.30.***.***",
"type" : "NOTE"
}
]
}
},
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
my %hash_sorted_by_day; for my $line (@logfile) { my %tmphash; my ($logdate, $logtime, $logip, $logsid, $logtype, $logmsg) = $line =~ m/([\d-]{10}) # date \s # _blank ([\d:]{8}) # time \s-\s # _divider ([\d\.]+) # IP \s-\s # _divider SID:([a-zA-Z0-9]{32}) # sid \s # _blank \[([A-Z]+)\] # LogType \s # _blank (.*)/xms; # message $tmphash{'time'} = $logtime; $tmphash{'ip'} = $logip; $tmphash{'type'} = $logtype; $tmphash{'msg'} = $logmsg; my @tmparray = defined $hash_sorted_by_day{$logdate}{$logsid} ? @{$hash_sorted_by_day{$logdate}{$logsid}} : () ; push (@tmparray, \%tmphash); $hash_sorted_by_day{$logdate}{$logsid} = \@tmparray; };