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

Jeff Atwood
  • 63,320
  • 48
  • 150
  • 153
Scott Hanselman
  • 17,712
  • 6
  • 74
  • 89

1 Answers1

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"
Jeff Atwood
  • 63,320
  • 48
  • 150
  • 153
Scott Hanselman
  • 17,712
  • 6
  • 74
  • 89
  • No one can, you just get the +points for the upvotes, you can close the question (not allowing more answers), but that freezes voting.. – Rob Cooper Sep 17 '08 at 07:59
  • 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? – Scott Hanselman Sep 17 '08 at 08:01
  • 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 :) – Rob Cooper Sep 17 '08 at 08:04
  • Heh. I think I'm just going to hang out inside this tiny comment box. This is my new HanselIRC. – Scott Hanselman Sep 17 '08 at 08:13
  • LOL! Do you not find it annoying having to keep clicking "show" though? Although it is pretty cool seeing your votes go up.. – Rob Cooper Sep 17 '08 at 08:17
  • 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. – Scott Hanselman Sep 17 '08 at 08:25
  • 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 :) – Rob Cooper Sep 17 '08 at 08:28
  • hehe... this is another way to use SO... Public IM! ;) – Adhip Gupta Sep 17 '08 at 08:51
  • Yes! Although, this refresh this is troublesome. ;) Also, the font is VERY small on Google Crome. – Scott Hanselman Sep 17 '08 at 08:52
  • 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 :) – Rob Cooper Sep 17 '08 at 08:53
  • http://stackoverflow.com/badges/28/famous-question - There it is people, thats what we want to win for Scott :D – Rob Cooper Sep 17 '08 at 08:54
  • 4
    Apparently I'd just got a COMMENTATOR badge for talking to myself. – Scott Hanselman Sep 17 '08 at 08:56
  • 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? :D – Rob Cooper Sep 17 '08 at 09:00
  • Scott, this is a cheap shot to get rep ;-) As if you don't have enough rep as is? :P – Jonas Follesø Sep 17 '08 at 09:13
  • What are you talking about Jonas?! I never even knew who Scott was until I saw this question! :p :D – Rob Cooper Sep 17 '08 at 09:19
  • This comment section could end up being a good stress-test. How many comments before the "Show Comments" call dies? – Mark Biek Sep 17 '08 at 14:06
  • 1
    Do I want REP? What can I buy with REP? ;) – Scott Hanselman Sep 17 '08 at 21:25