Logstash Configuration for CloudFoundry Loggregator -
i facing issues in setting logstash cloud foundry ever sources have seen have directed me following configuration
input { tcp { port => 5000 type => syslog } udp { port => 5000 type => syslog } } filter { if [@type] in ["syslog", "relp"] { # parse cloud foundry logs loggregator (syslog) # see https://github.com/cloudfoundry/loggregator/blob/master/src/loggregator/sinks/syslogwriter/syslog_writer.go#l156 grok { match => { "syslog_procid" => "\[(?<log_source>[^/\]]+)(?:/(?<log_source_id>[^\]]+))?\]" } tag_on_failure => [ "fail/logsearch-for-cloudfoundry/loggregator/_grokparsefailure" ] } if !("fail/logsearch-for-cloudfoundry/loggregator/_grokparsefailure" in [tags]) { #if looks json, must json... if [syslog_message] =~ /^\s*{".*}\s*$/ { json { source => "syslog_message" } # @todo seems messages have @timestamp in them? seems ci-specific date { match => [ "@timestamp", "iso8601" ] } } else { mutate { add_field => [ "message", "%{syslog_message}" ] } if [message] == "-" { mutate { remove_field => "message" } } } mutate { rename => [ "syslog_program", "@source.app_id" ] } mutate { add_tag => "cloudfoundry_loggregator" remove_field => "syslog_facility" remove_field => "syslog_facility_code" remove_field => "syslog_message" remove_field => "syslog_severity" remove_field => "syslog_severity_code" remove_field => "syslog5424_ver" remove_field => "syslog6587_msglen" } } } } output { stdout { codec => rubydebug } }
but none of filter matching logs cloud foundry ,i ma getting logs following
2015-08-03t09:51:15.000+00:00 [rtr] out mm1-spring-music.example.com - [03/08/2015:09:51:15 +0000] "get /assets/templates/grid.html http/1.1" 200 1450 "http://mm1-spring-music.example.com/" "mozilla/5.0 (windows nt 6.3; wow64) applewebkit/537.36 (khtml, gecko) chrome/44.0.2403.125 safari/537.36" 10.10.125.30:37611 x_forwarded_for:"xx.xx, 0.0.0.0" vcap_request_id:ae307d85-01c3-433b-487d-92d897dbcf99 response_time:0.002201911 app_id:08be9fc8-c7a3-4613-bf12-1a9c7d98cc27
kindly suggest if pattern exists can used parsing using logstash
make sure using relp
protocol in cloud foundry deployment manifest. filter if [@type] in ["syslog", "relp"]
testing type.
if using normal udp syslog or tcp, remove clause filter. can in kibana going settings->objects->searches , disabling filter or removing relp
condition.
Comments
Post a Comment