使用日志解析器解析不同文件夹中的大量日志 [英] Using log parser to parse lot of logs in different folders

查看:125
本文介绍了使用日志解析器解析不同文件夹中的大量日志的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近开始使用带有可视界面的 Log Parser

I recently started to use Log Parser with visual interface.

我要解析的日志来了来自IIS,它们与SharePoint相关。例如,我想知道有多少人访问了特定的网页等。

The logs that I want to parse come from IIS, and they are related to SharePoint. For example, I want to know how many people were visiting particular web pages, etc.

似乎IIS在不同的文件夹中创建了日志(我不知道为什么并且每天在不同的文件夹中都有一个新的日志文件。

And it seems that IIS creates logs in different folders (I don't know why) and every day there is a new log file in a different folder.

所以我的问题是,是否可以在不同的文件夹中处理所有这些文件?

So my question is, is it possible to approach all those files in different folders?

我知道你可以使用 From-clause ,放置不同的文件夹,但是如果在将来的新文件夹中这太难了添加。目标是创建一个将被执行的脚本。

I know you can use From-clause, put different folders, but it is too difficult especially if in the future new folders are added. The goal is to create one script which would be executed.

因此,例如在名为 LogFIles 的文件夹日志中,我有文件夹folder1,folder2 ,folder3,folder4等,每个文件夹中都有日志文件log1,log2,log3,logN等。

So for example in a folder log named LogFIles, I have folders folder1, folder2, folder3, folder4, etc. and in each folder there are log files log1, log2, log 3, logN, etc.

所以我的查询应该是这样的:选择* FROM path / LogFiles / * / * .log 但是日志解析器不接受它,那么如何实现呢?

So my query should be like this: Select * FROM path/LogFiles/*/*.log but the log parser doesn't accept it, so how to realize it?

推荐答案

调用logparser时可以使用-recurse选项。

You can use the -recurse option when calling logparser.

例如:

logparser file:"query.sql" -i:IISW3C -o:CSV -recurse

其中query.sql包含:

where query.sql contains:

select *
from .\Logs\*.log

在我目前的目录中,有一个目录称为Logs,包含多个子目录,每个子目录包含日志文件。例如:

and in my current directory, there is a directory called "Logs" that contains multiple sub-directories, each containing log files. Such as:

\Logs\server1\W3SVC1
\Logs\server1\W3SVC2 
\Logs\server2\W3SVC1 
\Logs\server2\W3SVC2 
etc.

这篇关于使用日志解析器解析不同文件夹中的大量日志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆