parent
1c2965703d
commit
281a4d5500
|
@ -45,6 +45,7 @@ should now look like:
|
||||||
- [#1437](https://github.com/influxdata/telegraf/pull/1437): Fetching Galera status metrics in MySQL
|
- [#1437](https://github.com/influxdata/telegraf/pull/1437): Fetching Galera status metrics in MySQL
|
||||||
- [#1500](https://github.com/influxdata/telegraf/pull/1500): Aerospike plugin refactored to use official client lib.
|
- [#1500](https://github.com/influxdata/telegraf/pull/1500): Aerospike plugin refactored to use official client lib.
|
||||||
- [#1434](https://github.com/influxdata/telegraf/pull/1434): Add measurement name arg to logparser plugin.
|
- [#1434](https://github.com/influxdata/telegraf/pull/1434): Add measurement name arg to logparser plugin.
|
||||||
|
- [#1479](https://github.com/influxdata/telegraf/pull/1479): logparser: change resp_code from a field to a tag.
|
||||||
|
|
||||||
### Bugfixes
|
### Bugfixes
|
||||||
|
|
||||||
|
|
|
@ -99,13 +99,12 @@ func TestMeasurementName(t *testing.T) {
|
||||||
"resp_bytes": int64(2326),
|
"resp_bytes": int64(2326),
|
||||||
"auth": "frank",
|
"auth": "frank",
|
||||||
"client_ip": "127.0.0.1",
|
"client_ip": "127.0.0.1",
|
||||||
"resp_code": int64(200),
|
|
||||||
"http_version": float64(1.0),
|
"http_version": float64(1.0),
|
||||||
"ident": "user-identifier",
|
"ident": "user-identifier",
|
||||||
"request": "/apache_pb.gif",
|
"request": "/apache_pb.gif",
|
||||||
},
|
},
|
||||||
m.Fields())
|
m.Fields())
|
||||||
assert.Equal(t, map[string]string{"verb": "GET"}, m.Tags())
|
assert.Equal(t, map[string]string{"verb": "GET", "resp_code": "200"}, m.Tags())
|
||||||
assert.Equal(t, "my_web_log", m.Name())
|
assert.Equal(t, "my_web_log", m.Name())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,7 +123,6 @@ func TestBuiltinInfluxdbHttpd(t *testing.T) {
|
||||||
"resp_bytes": int64(0),
|
"resp_bytes": int64(0),
|
||||||
"auth": "-",
|
"auth": "-",
|
||||||
"client_ip": "::1",
|
"client_ip": "::1",
|
||||||
"resp_code": int64(204),
|
|
||||||
"http_version": float64(1.1),
|
"http_version": float64(1.1),
|
||||||
"ident": "-",
|
"ident": "-",
|
||||||
"referrer": "-",
|
"referrer": "-",
|
||||||
|
@ -133,7 +131,7 @@ func TestBuiltinInfluxdbHttpd(t *testing.T) {
|
||||||
"agent": "InfluxDBClient",
|
"agent": "InfluxDBClient",
|
||||||
},
|
},
|
||||||
m.Fields())
|
m.Fields())
|
||||||
assert.Equal(t, map[string]string{"verb": "POST"}, m.Tags())
|
assert.Equal(t, map[string]string{"verb": "POST", "resp_code": "204"}, m.Tags())
|
||||||
|
|
||||||
// Parse an influxdb GET request
|
// Parse an influxdb GET request
|
||||||
m, err = p.ParseLine(`[httpd] ::1 - - [14/Jun/2016:12:10:02 +0100] "GET /query?db=telegraf&q=SELECT+bytes%2Cresponse_time_us+FROM+logparser_grok+WHERE+http_method+%3D+%27GET%27+AND+response_time_us+%3E+0+AND+time+%3E+now%28%29+-+1h HTTP/1.1" 200 578 "http://localhost:8083/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.84 Safari/537.36" 8a3806f1-3220-11e6-8006-000000000000 988`)
|
m, err = p.ParseLine(`[httpd] ::1 - - [14/Jun/2016:12:10:02 +0100] "GET /query?db=telegraf&q=SELECT+bytes%2Cresponse_time_us+FROM+logparser_grok+WHERE+http_method+%3D+%27GET%27+AND+response_time_us+%3E+0+AND+time+%3E+now%28%29+-+1h HTTP/1.1" 200 578 "http://localhost:8083/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.84 Safari/537.36" 8a3806f1-3220-11e6-8006-000000000000 988`)
|
||||||
|
@ -144,7 +142,6 @@ func TestBuiltinInfluxdbHttpd(t *testing.T) {
|
||||||
"resp_bytes": int64(578),
|
"resp_bytes": int64(578),
|
||||||
"auth": "-",
|
"auth": "-",
|
||||||
"client_ip": "::1",
|
"client_ip": "::1",
|
||||||
"resp_code": int64(200),
|
|
||||||
"http_version": float64(1.1),
|
"http_version": float64(1.1),
|
||||||
"ident": "-",
|
"ident": "-",
|
||||||
"referrer": "http://localhost:8083/",
|
"referrer": "http://localhost:8083/",
|
||||||
|
@ -153,7 +150,7 @@ func TestBuiltinInfluxdbHttpd(t *testing.T) {
|
||||||
"agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.84 Safari/537.36",
|
"agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.84 Safari/537.36",
|
||||||
},
|
},
|
||||||
m.Fields())
|
m.Fields())
|
||||||
assert.Equal(t, map[string]string{"verb": "GET"}, m.Tags())
|
assert.Equal(t, map[string]string{"verb": "GET", "resp_code": "200"}, m.Tags())
|
||||||
}
|
}
|
||||||
|
|
||||||
// common log format
|
// common log format
|
||||||
|
@ -173,13 +170,12 @@ func TestBuiltinCommonLogFormat(t *testing.T) {
|
||||||
"resp_bytes": int64(2326),
|
"resp_bytes": int64(2326),
|
||||||
"auth": "frank",
|
"auth": "frank",
|
||||||
"client_ip": "127.0.0.1",
|
"client_ip": "127.0.0.1",
|
||||||
"resp_code": int64(200),
|
|
||||||
"http_version": float64(1.0),
|
"http_version": float64(1.0),
|
||||||
"ident": "user-identifier",
|
"ident": "user-identifier",
|
||||||
"request": "/apache_pb.gif",
|
"request": "/apache_pb.gif",
|
||||||
},
|
},
|
||||||
m.Fields())
|
m.Fields())
|
||||||
assert.Equal(t, map[string]string{"verb": "GET"}, m.Tags())
|
assert.Equal(t, map[string]string{"verb": "GET", "resp_code": "200"}, m.Tags())
|
||||||
}
|
}
|
||||||
|
|
||||||
// combined log format
|
// combined log format
|
||||||
|
@ -199,7 +195,6 @@ func TestBuiltinCombinedLogFormat(t *testing.T) {
|
||||||
"resp_bytes": int64(2326),
|
"resp_bytes": int64(2326),
|
||||||
"auth": "frank",
|
"auth": "frank",
|
||||||
"client_ip": "127.0.0.1",
|
"client_ip": "127.0.0.1",
|
||||||
"resp_code": int64(200),
|
|
||||||
"http_version": float64(1.0),
|
"http_version": float64(1.0),
|
||||||
"ident": "user-identifier",
|
"ident": "user-identifier",
|
||||||
"request": "/apache_pb.gif",
|
"request": "/apache_pb.gif",
|
||||||
|
@ -207,7 +202,7 @@ func TestBuiltinCombinedLogFormat(t *testing.T) {
|
||||||
"agent": "Mozilla",
|
"agent": "Mozilla",
|
||||||
},
|
},
|
||||||
m.Fields())
|
m.Fields())
|
||||||
assert.Equal(t, map[string]string{"verb": "GET"}, m.Tags())
|
assert.Equal(t, map[string]string{"verb": "GET", "resp_code": "200"}, m.Tags())
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCompileStringAndParse(t *testing.T) {
|
func TestCompileStringAndParse(t *testing.T) {
|
||||||
|
|
|
@ -66,7 +66,7 @@ INFLUXDB_HTTPD_LOG \[httpd\] %{COMBINED_LOG_FORMAT} %{UUID:uuid:drop} %{NUMBER:r
|
||||||
|
|
||||||
# apache & nginx logs, this is also known as the "common log format"
|
# apache & nginx logs, this is also known as the "common log format"
|
||||||
# see https://en.wikipedia.org/wiki/Common_Log_Format
|
# see https://en.wikipedia.org/wiki/Common_Log_Format
|
||||||
COMMON_LOG_FORMAT %{CLIENT:client_ip} %{NGUSER:ident} %{NGUSER:auth} \[%{HTTPDATE:ts:ts-httpd}\] "(?:%{WORD:verb:tag} %{NOTSPACE:request}(?: HTTP/%{NUMBER:http_version:float})?|%{DATA})" %{NUMBER:resp_code:int} (?:%{NUMBER:resp_bytes:int}|-)
|
COMMON_LOG_FORMAT %{CLIENT:client_ip} %{NGUSER:ident} %{NGUSER:auth} \[%{HTTPDATE:ts:ts-httpd}\] "(?:%{WORD:verb:tag} %{NOTSPACE:request}(?: HTTP/%{NUMBER:http_version:float})?|%{DATA})" %{NUMBER:resp_code:tag} (?:%{NUMBER:resp_bytes:int}|-)
|
||||||
|
|
||||||
# Combined log format is the same as the common log format but with the addition
|
# Combined log format is the same as the common log format but with the addition
|
||||||
# of two quoted strings at the end for "referrer" and "agent"
|
# of two quoted strings at the end for "referrer" and "agent"
|
||||||
|
|
|
@ -62,7 +62,7 @@ INFLUXDB_HTTPD_LOG \[httpd\] %{COMBINED_LOG_FORMAT} %{UUID:uuid:drop} %{NUMBER:r
|
||||||
|
|
||||||
# apache & nginx logs, this is also known as the "common log format"
|
# apache & nginx logs, this is also known as the "common log format"
|
||||||
# see https://en.wikipedia.org/wiki/Common_Log_Format
|
# see https://en.wikipedia.org/wiki/Common_Log_Format
|
||||||
COMMON_LOG_FORMAT %{CLIENT:client_ip} %{NGUSER:ident} %{NGUSER:auth} \[%{HTTPDATE:ts:ts-httpd}\] "(?:%{WORD:verb:tag} %{NOTSPACE:request}(?: HTTP/%{NUMBER:http_version:float})?|%{DATA})" %{NUMBER:resp_code:int} (?:%{NUMBER:resp_bytes:int}|-)
|
COMMON_LOG_FORMAT %{CLIENT:client_ip} %{NGUSER:ident} %{NGUSER:auth} \[%{HTTPDATE:ts:ts-httpd}\] "(?:%{WORD:verb:tag} %{NOTSPACE:request}(?: HTTP/%{NUMBER:http_version:float})?|%{DATA})" %{NUMBER:resp_code:tag} (?:%{NUMBER:resp_bytes:int}|-)
|
||||||
|
|
||||||
# Combined log format is the same as the common log format but with the addition
|
# Combined log format is the same as the common log format but with the addition
|
||||||
# of two quoted strings at the end for "referrer" and "agent"
|
# of two quoted strings at the end for "referrer" and "agent"
|
||||||
|
|
Loading…
Reference in New Issue