Log Parser recusive file read

自闭症网瘾萝莉.ら 提交于 2019-12-12 19:18:54

问题


I'm trying to using Micorosofts Log Parser to read multiple sets of IIS log files. Now, my query works fine, however, to get it to work properly, I need to have the directory listed that the files exist directly under.

I want to be able to do a recursive search under a high level directory. I have found how to do this thru the DLLs, but I can't find how with the command prompt.

There has to be a simple solution to this, and I'm just missing it.


回答1:


Add the -recurse:-1 option to the command-line. Check the available command-line options for your input format with: C:\>logparser -h -i:IIS

Example output:

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)



回答2:


I couldnt run a -recurse if the import format was set to W3C. (-i:W3C)

For this I simply added added the following in Powershell when specifying the file/folder path. E.G $httpLogPath = "Get-ChildItem Y:\Data\folder* -include *.log -recurse"



来源:https://stackoverflow.com/questions/16449324/log-parser-recusive-file-read

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!