如何在 LogParser 查询中使用“标准偏差”函数?

问题描述 投票:0回答:1

我仍然使用(非常)旧的 Microsoft LogParser 2.2 工具来针对我的 IIS 日志文件发送类似 SQL 的查询。

我想在查询中使用“耗时”的“标准差”,但 Logparser 没有“标准差”功能。

还有其他方法可以在 LogParser 中获得此功能吗?

iis logparser
1个回答
0
投票

找到了我写的解决方案17!几年前在旧的 IIS LogParser 论坛 (web.archive.org/web/20080913193200/http://forums.iis.net/t/…)

对于我当前的用例,查询如下所示:

    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

© www.soinside.com 2019 - 2024. All rights reserved.