Question

I'm trying to using Microsoft's 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.

Was it helpful?

Solution

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)

OTHER TIPS

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"

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top