Search code examples
iislogparser

How do I use LogParser to find out the LENGTH of a field in an IIS Log?


I'm trying to find LONG UserAgent strings with LogParser.exe in my IIS logs. This example searches for entries with the string 'poo' in them.

LogParser.exe -i:IISW3C 
"SELECT COUNT(cs(User-Agent)) AS Client 
FROM *.log WHERE cs(User-Agent) LIKE '%poo%'"

I'm trying to say "How many entries have a User-Agent that is longer than 'x'".


Solution

  • Well, looks like I answered my own question.

    LogParser.exe -i:IISW3C 
    "SELECT COUNT(cs(User-Agent)) AS Client 
    FROM *.log WHERE STRLEN(cs(User-Agent)) > 100"