Created
June 22, 2018 07:55
-
-
Save Cynede/7f2ed93fa482af6c2f27d0b777af65fd to your computer and use it in GitHub Desktop.
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 { | |
| tcp { | |
| mode => "server" | |
| port => 678 | |
| # Not using "codec => multiline" here because it adds random line breaks to input. See the following links for more details: | |
| # https://github.com/elastic/logstash/issues/2925 | |
| # https://github.com/logstash-plugins/logstash-codec-multiline/issues/14 | |
| # https://github.com/logstash-plugins/logstash-codec-multiline/issues/37 | |
| # According to Elastic docs (https://www.elastic.co/guide/en/logstash/current/multiline.html), multiline codec | |
| # should not be used with input plugins that support multiple hosts (tcp input plugin is obviously one of them). | |
| } | |
| } | |
| filter | |
| { | |
| mutate | |
| { | |
| gsub => [ 'message','"','"' ] | |
| } | |
| mutate | |
| { | |
| gsub => [ 'message','\n','\\n' ] | |
| } | |
| if [message] =~ /^{.*}/ | |
| { | |
| json { source => message } | |
| } | |
| else | |
| { | |
| drop {} | |
| } | |
| } | |
| output { | |
| elasticsearch { | |
| hosts => ["127.0.0.1:9200"] | |
| sniffing => false | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment