Created
March 16, 2016 06:26
-
-
Save toast38coza/446265eb3dd29d1af3a0 to your computer and use it in GitHub Desktop.
Sending filebeats to logstash
This file contains hidden or 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
| # this goes on the server with the logs | |
| filebeat: | |
| prospectors: | |
| - | |
| paths: | |
| - "/var/log/nginx/*" | |
| document_type: nginx-logs | |
| registry_file: "/var/log/beat.log" | |
| output: | |
| logstash: | |
| # replace with appropriate values for your setup: | |
| hosts: ["logstash.service.consul:5044"] |
This file contains hidden or 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 { | |
| stdin { } | |
| beats { | |
| port => 5044 | |
| } | |
| } | |
| filter { | |
| # type is set by document_type in filebeats | |
| if [type] == "nginx-logs" { | |
| grok { | |
| match => { "message" => "%{NGINXACCESS}" } | |
| } | |
| geoip { | |
| source => "clientip" | |
| } | |
| } | |
| } | |
| ## Add your filters here | |
| output { | |
| elasticsearch { | |
| hosts => "elasticsearch:9200" | |
| index => "%{index}-%{type}-%{+YYYY.MM.dd}" | |
| } | |
| stdout { codec => rubydebug } | |
| } |
This file contains hidden or 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
| # put it at: /opt/logstash/patterns/nginx | |
| NGUSERNAME [a-zA-Z\.\@\-\+_%]+ | |
| NGUSER %{NGUSERNAME} | |
| NGINXACCESS %{IPORHOST:clientip} %{NGUSER:ident} %{NGUSER:auth} \[%{HTTPDATE:timestamp}\] "%{WORD:verb} %{URIPATHPARAM:request} HTTP/%{NUMBER:httpversion}" %{NUMBER:response} (?:%{NUMBER:bytes}|-) (?:"(?:%{URI:referrer}|-)"|%{QS:referrer}) %{QS:agent} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment