diff --git a/README.md b/README.md new file mode 100644 index 0000000..89d751f --- /dev/null +++ b/README.md @@ -0,0 +1,47 @@ +# Nginx Log Viewer + +Just a simple script to view nginx logs. + +![](./img.png) + +## Install + +```bash +cargo install --git +``` + +## Setup + +You need to set up nginx to log in the following format: + +```nginx configuration +http { + # ... + + log_format main escape=json '{' + '"t":"$time_iso8601",' + '"m":"$request_method",' + '"p":"$server_protocol",' + '"s":$status,' + '"u":"$scheme://$host$request_uri",' + '"ip":"$remote_addr",' + '"ic":"$http_cf_connecting_ip",' + '"if":"$http_x_forwarded_for",' + '"ua":"$http_user_agent",' + '"sz":$body_bytes_sent,' + '"ut":"$upstream_response_time",' + '"rt":"$request_time",' + '"rf":"$http_referer"' + '}'; + + access_log /var/log/nginx-access-extra.log main; + + # ... +} +``` + +## Usage + +```bash +tail -f /var/log/nginx-access-extra.log | nginx-log-fmt +``` diff --git a/img.png b/img.png new file mode 100644 index 0000000..efb72fe Binary files /dev/null and b/img.png differ