get overview of web sites access from nginx logs. both in linux console and as a web page
https://goaccess.io/download#distro
...
Code Block |
---|
title | /etc/nginx/nginx.conf |
---|
|
log_format vcombined '$host:$server_port '
'$remote_addr - $remote_user [$time_local] '
'"$request" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent"';
access_log /var/log/nginx/access.log vcombined;
|
nginx static page
Code Block |
---|
|
* * * * * goaccess /var/log/nginx/access.log --log-format=VCOMBINED -a -o /var/www/html/index.html |
Code Block |
---|
vi /etc/nginx/sites-available/stat.conf |
Code Block |
---|
server {
listen 80;
server_name goaccess.example.com;
root /var/www/html/;
location / {
index index.html;
}
}
|
switch log rotation to monthly so page contain more data (if size of logs allows that)
Code Block |
---|
vi /etc/logrotate.d/nginx |
Code Block |
---|
|
/var/log/nginx/*.log {
monthly
missingok
rotate 3
notifempty
create 640 nginx adm
sharedscripts
postrotate
if [ -f /var/run/nginx.pid ]; then
kill -USR1 `cat /var/run/nginx.pid`
fi
endscript
} |
Image Added