我正在尝试使用Micorosofts Log Parser来读取多组IIS日志文件。现在,我的查询工作正常,但要使其正常工作,我需要列出文件直接存在的目录。
我希望能够在高级目录下进行递归搜索。我已经找到了如何通过DLL执行此操作,但我找不到如何使用命令提示符。
必须有一个简单的解决方案,我只是错过了它。
答案 0 :(得分:5)
将-recurse:-1
选项添加到命令行。使用以下命令检查输入格式的可用命令行选项:C:\>logparser -h -i:IIS
示例输出:
Input format: IIS (Microsoft IIS Log Format)
Parses Microsoft IIS log files
FROM syntax:
<filename> | <SiteID> [, <filename> | <SiteID> ... ]
<SiteID> = '<' SiteID '>'
SiteID can be a SiteID number, a fully qualified ADSI Path (e.g.
"//GABRIEGI1/W3SVC/1"), or a Site name (e.g. "My External Site"), eventually
containing wildcards
Parameters:
-locale <locale name> : 3-letter ID of the log file locale
[default value=DEF]
-returnExtraFields ON|OFF : Return additional fields in
Parameters field [default value=OFF]
-iCodepage <codepage ID> : Input codepage (-2=guess from
filename and/or LogInUTF8 property)
[default value=guess from filename
and/or LogInUTF8 property]
-recurse <level> : Max subdirectory recursion level
(0=no recurse, -1=all levels)
[default value=0]
-minDateMod <date> : Minimum file last modified date
[default value=not specified]
-iCheckpoint <checkpoint file> : Save checkpoint information to this
file [default value=no checkpoint]
Fields:
LogFilename (S) LogRow (I) UserIP (S) UserName (S)
Date (T) Time (T) ServiceInstance (S) HostName (S)
ServerIP (S) TimeTaken (I) BytesSent (I) BytesReceived (I)
StatusCode (I) Win32StatusCode (I) RequestType (S) Target (S)
Parameters (S)
答案 1 :(得分:1)
如果导入格式设置为W3C,我无法运行-recurse。 (-i:W3C)
为此,我简单地添加了在指定文件/文件夹路径时在Powershell中添加以下内容。例如 $ httpLogPath =&#34; Get-ChildItem Y:\ Data \ folder * -include * .log -recurse&#34;