我希望当此处由 aspnetsessionid 指示的某个用户会话在我在此应用程序上设置的 10 分钟会话超时之前超时时从 iis 中提取信息。
我正在尝试解析 iis 日志,但不确定如何获取每个 sessionid 并计算其持续了多少分钟。
解决第一部分之后,我将查找哪个会话以调用页面 timeout.aspx 结束,尽管最好在一个查询中指定这一点。
我正在尝试处理这个查询
SELECT
TO_STRING(time, 'm') as mins,
EXTRACT_TOKEN(EXTRACT_TOKEN(cs(Cookie), 1, 'ASP.NET_SessionId='), 0, ';+__ut') as ASPNETSESSIONID From C:\logs\ex11*.log
GROUP BY ASPNETSESSIONID, mins
以下是我尝试捕获的日志文件实例的示例
Line Number Date Time Client-IP Server IP Server Port Request Verb Request URI, ASPNETSessionID
255 4/1/2011 19:40:55 222.222.22.22 111.11.111.11 443 GET /webpage.aspx 1234567890
256 4/1/2011 19:40:55 222.222.22.22 111.11.111.11 443 GET /jscript/SessionTimeout/SessionTimeout.js 1234567890
257 4/1/2011 19:40:58 222.222.22.22 111.11.111.11 443 POST /VerifySession.aspx 1234567890
260 4/1/2011 19:41:04 222.222.22.22 111.11.111.11 443 POST /Formle.aspx 1234567890
261 4/1/2011 19:41:04 222.222.22.22 111.11.111.11 443 GET /jscript/SessionTimeout/SessionTimeout.js 1234567890
263 4/1/2011 19:41:05 222.222.22.22 111.11.111.11 443 POST /VerifySession.aspx 1234567890
265 4/1/2011 19:41:10 222.222.22.22 111.11.111.11 443 POST /FormItemsTable.aspx 1234567890
266 4/1/2011 19:41:10 222.222.22.22 111.11.111.11 443 GET /FormRecord.aspx 1234567890
267 4/1/2011 19:41:10 222.222.22.22 111.11.111.11 443 GET /jscript/SessionTimeout/SessionTimeout.js 1234567890
268 4/1/2011 19:41:12 222.222.22.22 111.11.111.11 443 POST /VerifySession.aspx 1234567890
273 4/1/2011 19:41:23 222.222.22.22 111.11.111.11 443 POST /FormRd.aspx 1234567890
274 4/1/2011 19:41:23 222.222.22.22 111.11.111.11 443 GET /jscript/SessionTimeout/SessionTimeout.js 1234567890
275 4/1/2011 19:41:25 222.222.22.22 111.11.111.11 443 POST /VerifySession.aspx 1234567890
276 4/1/2011 19:41:25 222.222.22.22 111.11.111.11 443 GET /Timeout.aspx 1234567890
答案1
将数据导入数据库,然后查询
SELECT * from ((SELECT MAX(LocalDateTime) FROM dpo.importtable AS [initial] WHERE sessionid = raw_data.sessionid) - (SELECT MIN(LocalDateTime) FROM dpo.importtable AS [initial] WHERE sessionid = raw_data.sessionid) as diff) as g where diff < CAST('1900-01-01 00:10:00.000' AS datetime)