| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163 |
- input {
- kafka {
- codec => json{}
- bootstrap_servers => "kafka:9092"
- topics => ["random"]
- client_id => "logstash_indexer_1"
- }
- kafka {
- codec => json{}
- bootstrap_servers => "kafka:9092"
- topics => ["apache"]
- client_id => "logstash_indexer_1"
- }
- kafka {
- codec => json{}
- bootstrap_servers => "kafka:9092"
- topics => ["random-forwarder"]
- client_id => "logstash_indexer_1"
- }
- kafka {
- codec => json{}
- bootstrap_servers => "kafka:9092"
- topics => ["apache-forwarder"]
- client_id => "logstash_indexer_1"
- }
- kafka {
- codec => json{}
- bootstrap_servers => "kafka:9092"
- topics => ["javalog"]
- client_id => "logstash_indexer_1"
- }
- }
- filter {
- if [type] == "nginx-access" {
- grok {
- match => [ "message" , "%{COMBINEDAPACHELOG}+%{GREEDYDATA:extra_fields}"]
- overwrite => [ "message" ]
- }
- mutate {
- convert => ["response", "integer"]
- convert => ["bytes", "integer"]
- convert => ["responsetime", "float"]
- }
- geoip {
- source => "clientip"
- target => "geoip"
- add_tag => [ "nginx-geoip" ]
- }
- date {
- match => [ "timestamp" , "dd/MMM/YYYY:HH:mm:ss Z" ]
- remove_field => [ "timestamp" ]
- }
- useragent {
- source => "agent"
- }
- }
- if [type] == "random" {
- 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" {
- 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" ]
- }
- }
- 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 {
- if [type] == "nginx-access" {
- elasticsearch {
- hosts => ["elasticsearch:9200"]
- index => "nginx-%{+YYYYMM}"
- }
- }
- if [type] == "random" {
- elasticsearch {
- hosts => ["elasticsearch:9200"]
- index => "random-%{+YYYYMM}"
- }
- }
- if [type] == "apache" {
- elasticsearch {
- hosts => ["elasticsearch:9200"]
- index => "apache-%{+YYYYMM}"
- }
- }
- if [type] == "javalog" {
- elasticsearch {
- hosts => ["elasticsearch:9200"]
- index => "javalog-%{+YYYYMM}"
- }
- }
- if [type] == "random-forwarder" {
- elasticsearch {
- hosts => ["elasticsearch:9200"]
- index => "randomforwarder-%{+YYYYMM}"
- }
- stdout {
- codec => rubydebug
- }
- }
- if [type] == "apache-forwarder" {
- elasticsearch {
- hosts => ["elasticsearch:9200"]
- index => "apacheforwarder-%{+YYYYMM}"
- }
- stdout {
- codec => rubydebug
- }
- }
- }
|