Comments (3)
The accounting_log
directive supports adding a log output to remote central syslog server with UDP or TCP protocol.
See here for an example: https://github.com/Lax/traffic-accounting-nginx-module/blob/master/samples/http.conf#L6
The support parameters are the same as Nginx logging directives: https://nginx.org/en/docs/syslog.html
On the central syslog server, you can receive and save the logs with a normal syslog implement(rsyslog, syslog-ng),
or use any other logging server such as logstash, to receive and process the logs.
See an example in this folder: https://github.com/Lax/traffic-accounting-nginx-module/tree/master/samples
syslog(UDP)
NGINX -----------------------> syslogd / logstash / or your own UDP server
from traffic-accounting-nginx-module.
Do you maybe have an example on how to log looks like in the end? I want to parse the used bandwidth per WebDAV User. Thanks in advance
from traffic-accounting-nginx-module.
The final log looks like this:
# HTTP
2018/05/14 14:18:18 [notice] 5#0: pid:5|from:1526278638|to:1526278659|accounting_id:HTTP_ECHO_HELLO|requests:4872|bytes_in:438480|bytes_out:730800|latency_ms:0|upstream_latency_ms:0|200:4872
2018/05/14 14:18:18 [notice] 5#0: pid:5|from:1526278638|to:1526278659|accounting_id:INDEX|requests:4849|bytes_in:421863|bytes_out:1857167|latency_ms:0|upstream_latency_ms:0|301:4849
# Stream
2018/05/14 14:18:22 [notice] 5#0: pid:5|from:1526278642|to:1526278659|accounting_id:TCP_PROXY_ECHO|sessions:9723|bytes_in:860343|bytes_out:2587967|latency_ms:4133|upstream_latency_ms:3810|200:9723
In the NGINX config file, use accounting_log
, let the result transfer to a syslog:
target. It's similar to error_log
of NGINX (reference)
accounting_log syslog:server=192.168.1.1:29124 ;
I was using logstash to collect the log, find the config file here
from traffic-accounting-nginx-module.
Related Issues (20)
- Stream module is not compatible with nginx-1.15 HOT 3
- Pre-build binaries HOT 1
- Release 2.0 = signal 17 (SIGCHLD) received HOT 3
- accounting_id should allow variables within a string
- NGINX 1.16.1 - dynamic module keeps crashing ( segfault ) HOT 7
- Is it possible to monitor hit/miss rate in the module? HOT 1
- The traffic-accounting-nginx-module included upstream_bytes? HOT 1
- issue with dynamic building: "no suitable image found" HOT 1
- Keep getting the same error after following the installation steps. HOT 2
- Dynamic module undefined symbol ngx_stream_get_variable_index problem HOT 4
- AUR package for nginx-mainline for this module
- Samples don't work with Elastic 7.x HOT 3
- Issues when loading as dynamic module on macOS HOT 8
- Memory leak
- Feature request: reset counters once a month
- Invalid ELF header error when loading module
- Constant crashing HOT 1
- Feature request: combined log entries
- no autoconf, no configure command
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from traffic-accounting-nginx-module.