@@ -27,6 +27,7 @@ When a new **request** hits the server, the module will try to find its `account
27
27
28
28
For every period (defined by ` interval ` ), a timer event is triggered, those metrics are rotated and exported to log files or sent to remote log servers.
29
29
30
+
30
31
---
31
32
32
33
# Quickstart
@@ -47,6 +48,13 @@ Reload nginx config with `nginx -s reload`. *Done!*
47
48
48
49
---
49
50
51
+ ## Dashboard
52
+
53
+ ** Dashboard - Visualize with Grafana**
54
+ ![ Accounting Dashboard] ( http://lax.github.io/traffic-accounting-nginx-module/images/accounting-dashboard.png )
55
+
56
+ ---
57
+
50
58
# Configuration
51
59
52
60
Edit your nginx.conf.
@@ -92,15 +100,15 @@ accounting
92
100
93
101
** default:** * accounting off*
94
102
95
- ** context:** * http*
103
+ ** context:** * http, stream *
96
104
97
105
accounting_log
98
106
--------------------
99
107
** syntax:** * accounting_log \< /path/to/log/file> \[ level] *
100
108
101
109
** default:** * -*
102
110
103
- ** context:** * http*
111
+ ** context:** * http, stream *
104
112
105
113
Configures logging.
106
114
@@ -116,7 +124,7 @@ accounting_id
116
124
117
125
** default:** * accounting_id default*
118
126
119
- ** context:** * server, location, if in location*
127
+ ** context:** * http, stream, server, location, if in location*
120
128
121
129
Sets the ` accounting_id ` string by user defined variable.
122
130
@@ -128,7 +136,7 @@ accounting_interval
128
136
129
137
** default:** * accounting_interval 60*
130
138
131
- ** context:** * http*
139
+ ** context:** * http, stream *
132
140
133
141
Specifies the reporting interval. Defaults to 60 seconds.
134
142
@@ -138,7 +146,7 @@ accounting_perturb
138
146
139
147
** default:** * accounting_perturb off*
140
148
141
- ** context:** * http*
149
+ ** context:** * http, stream *
142
150
143
151
Randomly staggers the reporting interval by 20% from the usual time.
144
152
@@ -147,11 +155,32 @@ Randomly staggers the reporting interval by 20% from the usual time.
147
155
This module can be configured to writes metrics to local file, remote log server or local syslog device.
148
156
149
157
Open-source log-aggregation software such as logstash also support syslog input, which will help you establish a central log server.
150
- See [ samples/elk /] ( samples/elk / ) for examples. [ ** Recommended** ]
158
+ See [ samples/logstash /] ( samples/logstash / ) for examples. [ ** Recommended** ]
151
159
152
160
To collect logs with local syslog,
153
161
refer [ Lax/ngx_http_accounting_module-utils] ( http://github.com/Lax/ngx_http_accounting_module-utils ) to for sample configuration / utils.
154
162
163
+ ## docker / docker-compose
164
+ To demonstrate with docker-compose, run
165
+
166
+ ```
167
+ docker-compose build
168
+ docker-compose up -d
169
+ ```
170
+
171
+ Open Grafana (address: ` http://localhost:3000 ` ) in your browser.
172
+
173
+ Create and configurate elasticsearch datasource with options:
174
+ ```
175
+ Type: elasticsearch
176
+ URL: http://elasticsearch:9200
177
+ Version: 5.6+
178
+ Min time interval: 1m
179
+ ```
180
+
181
+ Then import accounting dashboard from ` [samples/accounting-dashboard-grafana.json](samples/accounting-dashboard-grafana.json) ` .
182
+
183
+
155
184
## Metrics log format
156
185
157
186
```
0 commit comments