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

1

27

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'".

Salvidor answered 17/9, 2008 at 7:38 Comment(0)
S
45

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"
Salvidor answered 17/9, 2008 at 7:47 Comment(17)
No one can, you just get the +points for the upvotes, you can close the question (not allowing more answers), but that freezes voting..Noticeable
That's lame. It'll never turn green. Hey, how did you know I added comment? Is CTRL-F5 the way "notifications" work in this world?Salvidor
Yup, refresh is the key :) I don't know if we will ever get a good "subscribe" feature :( This post has inspired me for more content for my next SO post though. Thanks :)Noticeable
Heh. I think I'm just going to hang out inside this tiny comment box. This is my new HanselIRC.Salvidor
LOL! Do you not find it annoying having to keep clicking "show" though? Although it is pretty cool seeing your votes go up..Noticeable
I dunno...the REAL test for SO will be if and when they start dominating all Google results. I also am concerned about their database fragmentation, and I predict we'll see REAL problems with that and SQL Page size soon.Salvidor
Agreed, only time will tell I guess. IMO there is still also tons of work to be done on fundamental parts of the site.. Especially with regards to moderation.. But, I am just a humble user :)Noticeable
hehe... this is another way to use SO... Public IM! ;)Ruskin
Yes! Although, this refresh this is troublesome. ;) Also, the font is VERY small on Google Crome.Salvidor
Oh you need to change your default font, its under the spanner somewhere :D SO, you think with the chat we can make Mr Hanselman's first question on SO a "Hot" topic? :D Hell if we talk long enough you will get a nice badge :)Noticeable
stackoverflow.com/badges/28/famous-question - There it is people, thats what we want to win for Scott :DNoticeable
Apparently I'd just got a COMMENTATOR badge for talking to myself.Salvidor
Oh crap yeah, I dont think you would get the famous question goldie (currently awarded to someone IMO should not have it) because you made the question "community editable".. Silly Scott! Still, talking to yourself has never been so rewarding right? :DNoticeable
Scott, this is a cheap shot to get rep ;-) As if you don't have enough rep as is? :PLasseter
What are you talking about Jonas?! I never even knew who Scott was until I saw this question! :p :DNoticeable
This comment section could end up being a good stress-test. How many comments before the "Show Comments" call dies?Alyshaalysia
Do I want REP? What can I buy with REP? ;)Salvidor

© 2022 - 2024 — McMap. All rights reserved.