发布于 5年前

Linux-计算PV UV 独立ip

代码:

$cmd = "grep 'blog/post/click-task-system' /var/log/nginx/www.jc91715.top.access.log -c";
$ret = shell_exec($cmd);

echo "PV\n";
echo $ret;

$cmd = "grep 'blog/post/click-task-system' /var/log/nginx/www.jc91715.top.access.log | cut -d ' ' -f 1  | sort | uniq| wc -l";
$ret = shell_exec($cmd);

echo "UV\n";
echo $ret;

$cmd = "cat /var/log/nginx/www.jc91715.top.access.log | cut -d ' ' -f 1  | sort | uniq|wc -l";
$ret = shell_exec($cmd);

echo "独立ip\n";
echo $ret;

输出:

PV
5
UV
1
独立ip
240
©2020 edoou.com   京ICP备16001874号-3