使用 logparser 监控 http 日志
我遇到的情况是,我必须使用 logparer 来监视 Web 服务的执行时间,因为我无法运行 perfmon。这是因为我的客户提出了一些无理要求。
我有我的查询文档,但我想用动态文件名替换 u_ex110713.log,因为我想不断监视最新文件。我该如何实现它。 我愿意使用 dos 批处理文件,这样我就可以安排它并将结果通过管道传输到另一个批处理,如果阈值增加到 30 秒,该批处理将发出警报。
select TO_STRING(TO_LOCALTIME(TO_TIMESTAMP(date, time)), 'yyyy-MM-dd HH:mm') as timestamps,
count(timestamps),avg(div(time-taken,1000)),max(div(time-taken,1000)),min(div(time-taken,1000))
from \\server.qc.cgo.ca\c$\inetpub\logs\LogFiles\W3SVC1\u_ex110713.log
group by timestamps
order by timestamps asc
i have a situation where i have to monitor the execution time of the webservices using logparer as i cannot run perfmon. this is becoz of some unreasonable demands of my client.
i have my query documneted but i want to replace u_ex110713.log with the dynamic file name as i want to constantly monitor the latest file. how do i make it happen.
i am open to using dos batch file so i can schedule it and pipe the results to another batch which will alert if the threshold increases to 30 seconds.
select TO_STRING(TO_LOCALTIME(TO_TIMESTAMP(date, time)), 'yyyy-MM-dd HH:mm') as timestamps,
count(timestamps),avg(div(time-taken,1000)),max(div(time-taken,1000)),min(div(time-taken,1000))
from \\server.qc.cgo.ca\c$\inetpub\logs\LogFiles\W3SVC1\u_ex110713.log
group by timestamps
order by timestamps asc
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
老实说,如果我处于您的位置,我最终只会在目录中查询
*ex*.log
,因为知道每个月都有压缩和删除日志的流程。您可以获取当前的系统时间并使用它来创建 FROM 语句,但恐怕我的知识不是那么好,所以我不知道如何以 UTC 提取系统时间(假设您正在使用 IIS 默认值,您将需要文件翻转)。
也就是说,我不确定使用日志来触发计时结果是最好的选择。这不应该内置到系统本身吗?
Honestly, if I were in your place I'd just end up querying
*ex*.log
in the directory, knowing that processes are in place to zip and delete logs on a monthly basis.You could get the current system time and use it to create your FROM statement, but I'm afraid my knowledge isn't that great, so I'm not aware of a way to pull the system time in UTC (which, assuming you're using the IIS defaults, you would need for the file rollover).
That said, I'm not sure using the logs to trigger timing results is your best bet. Shouldn't this be built into the system itself?