Skip to content

Website access analytics based on nginx access log files

Notifications You must be signed in to change notification settings

drussilla/nginx-log-analytics

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nginx-log-analytics

Generate views report in the console based on nginx access log files.

alt text

alt text

NGINX configuration

  1. Edit /etc/nginx/nginx.conf (might be in the different location in your system) and add the following log format in to http section:
 log_format custom '$time_local | $remote_addr | $request | $status | $body_bytes_sent | $http_referer | $http_user_agent | $request_time';
  1. Edit your website configuration and specify previously defined log format for the access logs:
access_log /var/ivanderevianko.com/logs/access.log custom;

Run nginx-log-analytics

Configuration

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"
}

Run

Go to release folder: cd Release
make file executable: chmod +x NginxLogAnalytics
and run it: ./NginxLogAnalytics

Command line arguments

--Url <url> - Get a detailed overview of the specific URL
--Date <date> - Show all stats for the specified Date (instead of today's date)

Build nginx-log-analytics

Prerequesites

Publish

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

About

Website access analytics based on nginx access log files

Resources

Stars

Watchers

Forks

Packages

No packages published