|
@@ -2,7 +2,7 @@ input {
|
|
|
kafka {
|
|
kafka {
|
|
|
codec => json{}
|
|
codec => json{}
|
|
|
bootstrap_servers => "kafka:9092"
|
|
bootstrap_servers => "kafka:9092"
|
|
|
- topics => ["nginx-access", "random", "apache"]
|
|
|
|
|
|
|
+ topics => ["random", "apache", "random-forwarder", "apache-forwarder"]
|
|
|
client_id => "logstash_indexer_1"
|
|
client_id => "logstash_indexer_1"
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -61,6 +61,36 @@ filter {
|
|
|
remove_field => [ "timestamp" ]
|
|
remove_field => [ "timestamp" ]
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ if [type] == "random-forwarder" {
|
|
|
|
|
+ grok {
|
|
|
|
|
+ match => [ "message" , "(?<timestamp>%{YEAR}[./-]%{MONTHNUM}[./-]%{MONTHDAY}[- ]%{TIME}) %{NUMBER:pid} %{GREEDYDATA:filename} %{NUMBER:line} %{GREEDYDATA:logger} %{LOGLEVEL:severity} %{GREEDYDATA:quote}"]
|
|
|
|
|
+ overwrite => [ "message" ]
|
|
|
|
|
+ }
|
|
|
|
|
+ date {
|
|
|
|
|
+ match => [ "timestamp", "YYYY-MM-dd HH:mm:ss,SSS"]
|
|
|
|
|
+ remove_field => [ "timestamp" ]
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if [type] == "apache-forwarder" {
|
|
|
|
|
+ grok {
|
|
|
|
|
+ match => [ "message" , "%{COMBINEDAPACHELOG}"]
|
|
|
|
|
+ overwrite => [ "message" ]
|
|
|
|
|
+ }
|
|
|
|
|
+ mutate {
|
|
|
|
|
+ convert => ["response", "integer"]
|
|
|
|
|
+ convert => ["bytes", "integer"]
|
|
|
|
|
+ convert => ["responsetime", "float"]
|
|
|
|
|
+ }
|
|
|
|
|
+ geoip {
|
|
|
|
|
+ source => "clientip"
|
|
|
|
|
+ target => "geoip"
|
|
|
|
|
+ add_tag => [ "apache-geoip" ]
|
|
|
|
|
+ }
|
|
|
|
|
+ date {
|
|
|
|
|
+ match => [ "timestamp", "dd/MMM/yyyy:HH:mm:ss Z" ]
|
|
|
|
|
+ remove_field => [ "timestamp" ]
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
output {
|
|
output {
|
|
@@ -69,23 +99,32 @@ output {
|
|
|
hosts => ["elasticsearch:9200"]
|
|
hosts => ["elasticsearch:9200"]
|
|
|
index => "nginx-%{+YYYYMM}"
|
|
index => "nginx-%{+YYYYMM}"
|
|
|
}
|
|
}
|
|
|
- stdout {
|
|
|
|
|
- codec => rubydebug
|
|
|
|
|
- }
|
|
|
|
|
}
|
|
}
|
|
|
if [type] == "random" {
|
|
if [type] == "random" {
|
|
|
elasticsearch {
|
|
elasticsearch {
|
|
|
hosts => ["elasticsearch:9200"]
|
|
hosts => ["elasticsearch:9200"]
|
|
|
index => "random-%{+YYYYMM}"
|
|
index => "random-%{+YYYYMM}"
|
|
|
}
|
|
}
|
|
|
|
|
+ }
|
|
|
|
|
+ if [type] == "apache" {
|
|
|
|
|
+ elasticsearch {
|
|
|
|
|
+ hosts => ["elasticsearch:9200"]
|
|
|
|
|
+ index => "apache-%{+YYYYMM}"
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if [type] == "random-forwarder" {
|
|
|
|
|
+ elasticsearch {
|
|
|
|
|
+ hosts => ["elasticsearch:9200"]
|
|
|
|
|
+ index => "randomforwarder-%{+YYYYMM}"
|
|
|
|
|
+ }
|
|
|
stdout {
|
|
stdout {
|
|
|
codec => rubydebug
|
|
codec => rubydebug
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- if [type] == "apache" {
|
|
|
|
|
|
|
+ if [type] == "apache-forwarder" {
|
|
|
elasticsearch {
|
|
elasticsearch {
|
|
|
hosts => ["elasticsearch:9200"]
|
|
hosts => ["elasticsearch:9200"]
|
|
|
- index => "apache-%{+YYYYMM}"
|
|
|
|
|
|
|
+ index => "apacheforwarder-%{+YYYYMM}"
|
|
|
}
|
|
}
|
|
|
stdout {
|
|
stdout {
|
|
|
codec => rubydebug
|
|
codec => rubydebug
|