swobi
swobi

Reputation: 105

How can I use the "Standard Deviation" function in my LogParser queries?

I still use the (very) old Microsoft LogParser 2.2 Tool to send SQL-like queries against my IIS Logfiles.

I want to use the "Standard Deviation" of "time-taken" in my queries, but Logparser does not have a "Standard Deviation" function.

Is there another way to get this functionality in LogParser?

Upvotes: 0

Views: 107

Answers (1)

swobi
swobi

Reputation: 105

Found the solution in a post I wrote 17! years ago in the old IIS LogParser forum (web.archive.org/web/20080913193200/http://forums.iis.net/t/…)

for my current use case the query looks like this:

    select TO_LOWERCASE(cs-uri-stem) as csUriStem, COUNT(*) as Hits, 
       MIN(time-taken) as Min, 
       DIV (TO_REAL(SUM(time-taken)), Hits) as RealAvgTime, 
       MAX(time-taken) as Max, 
       SQRROOT(SUB(DIV(TO_REAL(SUM(SQR(time-taken))), Hits), SQR(RealAvgTime))) as StDev,
       STRCAT(TO_STRING(sc-status), STRCAT('.', TO_STRING(sc-substatus))) as HttpStatus
    from STDIN 
    where csUriStem like '%.php%' 
    group by csUriStem, HttpStatus 
    order by csUriStem, HttpStatus

Upvotes: 0

Related Questions