如何根据tomcat日志计算PV,ip,PU

时间:2011-02-18 05:56:35

标签: tomcat web-analytics

如何根据tomcat日志计算PV,ip,PU?

我已将tomcat日志导出到db。

可以找到有关数据库结构的内容here

对于ip我可以使用:

select count(distinct ip)...

但是pv和pu怎么样?

我不知道,如果你知道,请帮我一个忙。

1 个答案:

答案 0 :(得分:1)

这样的东西
SELECT 
    COUNT(SELECT DISTINCT ip from tblName) AS IPs, 
    COUNT(SELECT DISTINCT uri from tblName) AS UniquePages, 
    COUNT(SELECT DISTINCT username from tblName) as UniqueVisitors from tblName;

应该适合你


要限制应计算的页面类型,请将其添加到子查询

SELECT 
    COUNT(SELECT DISTINCT ip from tblName) AS IPs, 
    COUNT(SELECT DISTINCT uri from tblName WHERE uri NOT LIKE '%.js' AND uri NOT LIKE '.css') AS UniquePages, 
    COUNT(SELECT DISTINCT username from tblName) as UniqueVisitors from tblName;