Skip to content

Commit c5069c4

Browse files
authored
Merge pull request #27 from matsuu/enhance-config-file
Enhance config file
2 parents 5d80d74 + 854e4e6 commit c5069c4

File tree

2 files changed

+70
-22
lines changed

2 files changed

+70
-22
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ access-log:
3232
format: "%h %l %u %t \"%r\" %s %b \"%{Referer}i\" \"%{User-agent}i\" %{duration}x"
3333
```
3434

35+
### Envoy
36+
37+
Use [default format](https://www.envoyproxy.io/docs/envoy/latest/configuration/observability/access_log/usage#config-access-log-default-format)
38+
3539
### Varnishncsa
3640

3741
Add `%D` to [varnishncsa -F option](https://www.varnish-cache.org/docs/trunk/reference/varnishncsa.html).
@@ -52,6 +56,10 @@ use Rack::CommonLogger, logger
5256
Install via go command or download [release file](https://github.com/matsuu/kataribe/releases)
5357

5458
```sh
59+
# go >=1.16
60+
go install github.com/matsuu/kataribe@latest
61+
62+
# go <1.16
5563
go get -u github.com/matsuu/kataribe
5664
```
5765

toml.go

Lines changed: 62 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
package main
22

3-
const CONFIG_TOML = `# Top Ranking Group By Request
3+
const CONFIG_TOML = `################################################################################
4+
# General
5+
################################################################################
6+
7+
# Top Ranking Group By Request
48
ranking_count = 20
59
610
# Top Slow Requests
@@ -18,6 +22,10 @@ show_bytes = true
1822
# Percentiles
1923
percentiles = [ 50.0, 90.0, 95.0, 99.0 ]
2024
25+
################################################################################
26+
# Scale
27+
################################################################################
28+
2129
# for Nginx($request_time)
2230
scale = 0
2331
effective_digit = 3
@@ -26,59 +34,91 @@ effective_digit = 3
2634
#scale = -6
2735
#effective_digit = 6
2836
37+
# for H2O(%{duration}x)
38+
#scale = 0
39+
#effective_digit = 6
40+
41+
# for Envoy
42+
#scale = -3
43+
#effective_digit = 3
44+
2945
# for Rack(Rack::CommonLogger)
3046
#scale = 0
3147
#effective_digit = 4
3248
49+
################################################################################
50+
# Parse
51+
################################################################################
3352
53+
#
3454
# combined + duration
3555
# Nginx example: '$remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent" $request_time'
3656
# Apache example: "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %D"
3757
# H2O example: "%h %l %u %t \"%r\" %s %b \"%{Referer}i\" \"%{User-agent}i\" %{duration}x"
3858
# Varnishncsa example: '%h %l %u %t "%r" %s %b "%{Referer}i" "%{User-agent}i" %D'
59+
#
3960
log_format = '^([^ ]+) ([^ ]+) ([^ ]+) \[([^\]]+)\] "((?:\\"|[^"])*)" (\d+) (\d+|-) "((?:\\"|[^"])*)" "((?:\\"|[^"])*)" ([0-9.]+)$'
40-
4161
request_index = 5
4262
status_index = 6
4363
bytes_index = 7
4464
duration_index = 10
4565
66+
#
67+
# Envoy example: use default format
68+
#
69+
#log_format = '^\[([^\]]+)\] "((?:\\"|[^"])*)" (\d+) ([^ ]+) (\d+|-) (\d+|-) (\d+) (\d+) "((?:\\"|[^"])*)" "((?:\\"|[^"])*)" "((?:\\"|[^"])*)" "((?:\\"|[^"])*)" "((?:\\"|[^"])*)"'
70+
#request_index = 2
71+
#status_index = 3
72+
#bytes_index = 6
73+
#duration_index = 7
74+
75+
#
4676
# Rack example: use Rack::CommonLogger, Logger.new("/tmp/app.log")
77+
#
4778
#log_format = '^([^ ]+) ([^ ]+) ([^ ]+) \[([^\]]+)\] "((?:\\"|[^"])*)" (\d+) (\d+|-) ([0-9.]+)$'
4879
#request_index = 5
4980
#status_index = 6
5081
#bytes_index = 7
5182
#duration_index = 8
5283
84+
################################################################################
85+
# Bundle
86+
################################################################################
87+
88+
#
5389
# You can aggregate requests by regular expression
5490
# For overview of regexp syntax: https://golang.org/pkg/regexp/syntax/
55-
[[bundle]]
56-
regexp = '^(GET|HEAD) /memo/[0-9]+\b'
57-
name = "get memo"
58-
59-
[[bundle]]
60-
regexp = '^(GET|HEAD) /stylesheets/'
61-
name = "stylesheets"
91+
#
92+
#[[bundle]]
93+
#regexp = '^(GET|HEAD) /users/[0-9]+\b'
94+
#name = 'GET /memo/*'
95+
#
96+
#[[bundle]]
97+
#regexp = '^(GET|HEAD) /stylesheets/'
98+
#name = 'GET /stylesheets/*'
99+
#
100+
#[[bundle]]
101+
#regexp = '^(GET|HEAD) /images/'
102+
#name = 'GET /images/*'
62103
63-
[[bundle]]
64-
regexp = '^(GET|HEAD) /images/'
65-
name = "images"
104+
################################################################################
105+
# Replace
106+
################################################################################
66107
108+
#
67109
# You can replace the part of urls which matched to your regular expressions.
68110
# For overview of regexp syntax: https://golang.org/pkg/regexp/syntax/
69-
#[[replace]]
70-
#regexp = '/[0-9]+/'
71-
#replace = '/<num>/'
72111
#
73112
#[[replace]]
74-
#regexp = '/[0-9]+\s'
75-
#replace = '/<num> '
113+
#regexp = '/[0-9]+(/|\s)'
114+
#replace = '/<num>$1'
76115
#
77116
#[[replace]]
78-
#regexp = '=[0-9]+&'
79-
#replace = '=<num>&'
117+
#regexp = '=[0-9]+(&|\s)'
118+
#replace = '=<num>$1'
80119
#
81120
#[[replace]]
82-
#regexp = '=[0-9]+\s'
83-
#replace = '=<num> '
84-
`
121+
#regexp = '\s+HTTP/[0-9.]+$'
122+
#replace = ''
123+
124+
################################################################################`

0 commit comments

Comments
 (0)