lib/fluent/plugin/in_syslog.rb in fluentd-0.10.52 vs lib/fluent/plugin/in_syslog.rb in fluentd-0.10.53

- old
+ new

@@ -76,10 +76,12 @@ :udp else raise ConfigError, "syslog input protocol type should be 'tcp' or 'udp'" end end + config_param :include_source_host, :bool, :default => false + config_param :source_host_key, :string, :default => 'source_host'.freeze def configure(conf) super parser = TextParser.new @@ -135,10 +137,11 @@ unless time && record log.warn "pattern not match: #{text.inspect}" return end + record[@source_host_key] = addr[2] if @include_source_host emit(pri, time, record) } rescue => e log.error data.dump, :error => e.to_s log.error_backtrace @@ -150,9 +153,10 @@ log.warn "invalid syslog message", :data => data return end pri = record.delete('pri') + record[@source_host_key] = addr[2] if @include_source_host emit(pri, time, record) } rescue => e log.error data.dump, :error => e.to_s log.error_backtrace