Log Parser recursive file read
Asked Answered
J

2

2

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.

Jahdai answered 8/5, 2013 at 20:9 Comment(0)
A
6

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)
Astronaut answered 10/5, 2013 at 12:24 Comment(2)
Thanks, I kept running across that, but it would always say its an invalid flag. The flags that are available depend on what the file input type is set to.Jahdai
Exactly - which input format are you selecting? If you are not specifying any input format, Log Parser will figure one out for you based on your file, and you can tell which one it selected by looking at the WARNING output with the first line. Knowing which input format you're using is essential in determining whether the recursion option is available or not.Astronaut
A
1

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"

Amplification answered 24/6, 2015 at 10:29 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.