Skip to content

Commit 13e8083

Browse files
committed
Document: add dashboard config and screenshot
Signed-off-by: Liu Lantao <[email protected]>
1 parent 3b3718e commit 13e8083

File tree

6 files changed

+1653
-7
lines changed

6 files changed

+1653
-7
lines changed

README.md

Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ When a new **request** hits the server, the module will try to find its `account
2727

2828
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.
2929

30+
3031
---
3132

3233
# Quickstart
@@ -47,6 +48,13 @@ Reload nginx config with `nginx -s reload`. *Done!*
4748

4849
---
4950

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+
5058
# Configuration
5159

5260
Edit your nginx.conf.
@@ -92,15 +100,15 @@ accounting
92100

93101
**default:** *accounting off*
94102

95-
**context:** *http*
103+
**context:** *http, stream*
96104

97105
accounting_log
98106
--------------------
99107
**syntax:** *accounting_log \</path/to/log/file> \[level]*
100108

101109
**default:** *-*
102110

103-
**context:** *http*
111+
**context:** *http, stream*
104112

105113
Configures logging.
106114

@@ -116,7 +124,7 @@ accounting_id
116124

117125
**default:** *accounting_id default*
118126

119-
**context:** *server, location, if in location*
127+
**context:** *http, stream, server, location, if in location*
120128

121129
Sets the `accounting_id` string by user defined variable.
122130

@@ -128,7 +136,7 @@ accounting_interval
128136

129137
**default:** *accounting_interval 60*
130138

131-
**context:** *http*
139+
**context:** *http, stream*
132140

133141
Specifies the reporting interval. Defaults to 60 seconds.
134142

@@ -138,7 +146,7 @@ accounting_perturb
138146

139147
**default:** *accounting_perturb off*
140148

141-
**context:** *http*
149+
**context:** *http, stream*
142150

143151
Randomly staggers the reporting interval by 20% from the usual time.
144152

@@ -147,11 +155,32 @@ Randomly staggers the reporting interval by 20% from the usual time.
147155
This module can be configured to writes metrics to local file, remote log server or local syslog device.
148156

149157
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**]
151159

152160
To collect logs with local syslog,
153161
refer [Lax/ngx_http_accounting_module-utils](http://github.com/Lax/ngx_http_accounting_module-utils) to for sample configuration / utils.
154162

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+
155184
## Metrics log format
156185

157186
```

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ services:
2323
networks:
2424
- elk
2525
volumes:
26-
- ./samples/elkg:/etc/logstash
26+
- ./samples/logstash:/etc/logstash
2727
command: logstash -f /etc/logstash/logstash.conf
2828
depends_on:
2929
- elasticsearch

0 commit comments

Comments
 (0)