Generate views report in the console based on nginx access log files.
- Edit
/etc/nginx/nginx.conf
(might be in the different location in your system) and add the following log format in tohttp
section:
log_format custom '$time_local | $remote_addr | $request | $status | $body_bytes_sent | $http_referer | $http_user_agent | $request_time';
- Edit your website configuration and specify previously defined log format for the access logs:
access_log /var/ivanderevianko.com/logs/access.log custom;
Edit config.json
and specify the correct log folder (LogFilesFolderPath
property), in this examples it should be the following:
{
"LogFilesFolderPath": "/var/ivanderevianko.com/logs/",
"CrawlerUserAgentsFilePath": "ingore-user-agents.txt",
"ExcludeContentFilePath": "not-content-list.txt"
}
Go to release folder: cd Release
make file executable: chmod +x NginxLogAnalytics
and run it: ./NginxLogAnalytics
--Url <url> - Get a detailed overview of the specific URL
--Date <date> - Show all stats for the specified Date (instead of today's date)
- .Net core 3.1 SDK https://dotnet.microsoft.com/download/dotnet-core/3.1
Use publish.cmd
or the following command to create an linux-x64
executable:
dotnet publish src/NginxLogAnalytics/NginxLogAnalytics.csproj -c Release -o Release -r linux-x64 --no-self-contained