Created
June 8, 2018 07:17
-
-
Save AlexAkulov/f3819711681f7029a7cf52fa34754d1e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
input { | |
syslog { | |
port => {{ bitfan_syslogd_port }} | |
protocol => "udp" | |
type => "syslog" | |
} | |
} | |
filter { | |
kv { | |
field_split => "\\t" | |
include_brackets => false | |
source => "content" | |
value_split => "=" | |
remove_field => ["content"] | |
trim => "-" | |
} | |
# date { | |
# timezone => "Europe/Moscow" | |
# match => ["msec", "UNIX"] | |
# } | |
mutate { | |
convert => { | |
"rtime" => "float" | |
"urtime" => "float" | |
} | |
} | |
eval { | |
expressions => { | |
"rtime" => "[rtime] * 1000" | |
"urtime" => "[urtime] * 1000" | |
} | |
} | |
mutate { | |
lowercase => [ "uri" ] | |
} | |
mutate { | |
gsub => [ | |
"uri", "\/+", "/", | |
"uri", "\/", "_", | |
"uri", "^_", "", | |
"uri", "_$", "" | |
] | |
} | |
} | |
output { | |
if [type] == "syslog" { | |
statsd { | |
host => "localhost" | |
port => 8125 | |
protocol => "udp" | |
namespace => "{{ graphite_prefix }}.nginx" | |
sender => "marten-api" | |
increment => [ "response.total.%{status}", | |
"method.total.%{method}" ] | |
timing => { "response_time.total" => "%{rtime}", | |
"upstream_response_time.total" => "%{urtime}", | |
"response_bytes.total" => "%{bsent}", | |
"request_bytes.total" => "%{rlength}" | |
} | |
} | |
if [status] != "404" and [uri] !~ "^$" { | |
statsd { | |
host => "localhost" | |
port => 8125 | |
protocol => "udp" | |
namespace => "{{ graphite_prefix }}.nginx" | |
sender => "marten-api" | |
increment => [ "response.%{uri}.%{status}" ] | |
timing => { "response_time.%{uri}" => "%{rtime}", | |
"upstream_response_time.%{uri}" => "%{urtime}", | |
"response_bytes.%{uri}" => "%{bsent}", | |
"request_bytes.%{uri}" => "%{rlength}" | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nginx log format