[+] Readme
This commit is contained in:
@@ -0,0 +1,47 @@
|
|||||||
|
# Nginx Log Viewer
|
||||||
|
|
||||||
|
Just a simple script to view nginx logs.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cargo install --git <this repo>
|
||||||
|
```
|
||||||
|
|
||||||
|
## 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
|
||||||
|
```
|
||||||
Reference in New Issue
Block a user