平臺:Windows 2003與Perl 我正在研究如何將用戶標識切出IIS日誌文件。然後找出用戶做了什麼。上傳的文件,CWD ..這樣的事情。有[uniqu_ID]用戶ID。如何檢索該ID並搜索它做了什麼。請幫忙。解析Windows Server 2003上的日誌以查找用戶操作
5
A
回答
0
日誌分析器是一個功能強大,用途廣泛 工具,提供了通用查詢 訪問諸如日誌 文件,XML文件和CSV文件基於文本的數據, 以及關鍵數據例如 事件日誌,註冊表,文件 系統和ActiveDirectory®。
+0
我無法在服務器上下載任何內容。我必須與我目前的工作。在Windows 2003上的Perl – Moe 2011-02-13 01:56:19
+0
下載到你的本地盒子,並在那裏處理日誌。 – 2011-02-13 02:05:42
0
我在Windows 2003 Server here上找到了一個IIS日誌文件的例子。不過,請張貼您自己的示例日誌。
192.168.114.201, -, 03/20/01, 7:55:20, W3SVC2, SERVER, 172.21.13.45, 4502, 163, 3223, 200, 0, GET, /DeptLogo.gif, -,
因爲這不過是一個逗號分隔的文件,所以您有幾種不同的方式可以到這裏。如果您的計算機上安裝了該軟件,則可以使用Text::CSV。如果沒有,這是一個簡單的例子。
use strict;
use warnings;
use Data::Dumper;
my $user = {}; # we will store the actions in here
# This is what the log file looks like when split into an array
# 0: Client IP address
# 1: User name
# 2: Date
# 3: Time
# 4: Service and instance
# 5: Server name
# 6: Server IP
# 7: Time taken
# 8: Client bytes sent
# 9: Server bytes sent
# 10: Service status code
# 11: Windows status code
# 12: Request type
# 13: Target of operation
# 14: Parameters
open $log, '<', 'path/to/logfile.log';
while (my $line = <$log>) {
my @fields = split /, /, $line; # split on comma and space
# you'll get an array of actions for each user
push @{ $user->{$fields[1]} }, "$fields[12] $fields[13]";
# or more specific:
# push @{ $user->{$fields[1]} }, {
# 'time' => $fields[3],
# 'action' => $fields[12],
# 'target' => $fields[13],
# };
}
close $log;
print Dumper $user; # lets have a look
# More stuff to do with the data here...
這是輸出:
$VAR1 = {
'-' => [
'GET /DeptLogo.gif'
]
};
然後你可以去和$user
內容寫入到另一個文件,或文件組。
foreach my $u (sort keys %$user) {
print "$u\r\n";
foreach $action (@{ $user->{$u} }) {
print "$action\r\n";
}
}
相關問題
- 1. Windows Server 2003上log4j日誌的錯誤時間
- 2. Windows Server 2003(IIS) - 查找我的FTP ..
- 3. log4net不在Windows Server 2003上創建日誌文件
- 4. 啓用日誌OpenSSH中,Windows 2003的箱
- 5. 在Windows Server 2003操作系統上優化IIS 6.0的性能
- 6. 在Windows Server 2003上的SocketException
- 7. Windows Server 2003上的Log4Net
- 8. Windows Server 2008 r2上的遠程用戶日誌信息
- 9. 日誌流量(包括髮布的數據)IIS 6.0 - windows server 2003
- 10. SetWindowPos無法在Windows Server 2003上工作?
- 11. 如何在parse-server上查看日誌?
- 12. Windows Server 2003用戶登錄審覈
- 13. Logstash解析不同日誌的不同操作
- 14. Windows Server 2003上的IE6 Standalone上的Cookie?
- 15. Mercurial&Windows Server 2003
- 16. 解析skype日誌
- 17. QRadar,解析日誌
- 18. 找不到融合日誌查看器Windows Server 2012 Visual Studio 2013
- 19. 無法在Windows 2003服務器上打開源{0}的日誌
- 20. 按日誌行解析日誌文件
- 21. 不能從Windows Server中訪問存儲在Windows Server 2003上的WebService 2003
- 22. AspectJ操作日誌
- 23. 查找Linux機器上的SQL Server錯誤日誌
- 24. Linux的日誌解析器
- 25. 您可以在MySQL Replication Server上啓用日誌查詢嗎?
- 26. ASP .NET - 在Windows Server 2003(終端服務)上獲取用戶名?
- 27. (Windows Server 2003中)CACLS.EXE使用
- 28. Windows Server 2003 64位上的ASP.NET 4.0
- 29. Mysterious process - RunSilent - Windows Server 2003上的錯誤
- 30. Windows Server 2003上的經典ASP
請問您可以發表幾行代碼示例嗎?這個問題似乎很容易,但例子會很好。 – simbabque 2012-04-26 08:33:41