Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ Defaults to `syslog_rfc5424`
| name |type | description |
| -------------- | ------- | ------- |
| rfc6587_message_size | boolean | prepends message length for syslog transmission (true by default) |
| priority | integer | sets priority in syslog from field in fluentd, delimited by '.' (default priority) |
| hostname_field | string | sets host name in syslog from field in fluentd, delimited by '.' (default hostname) |
| app_name_field | string | sets app name in syslog from field in fluentd, delimited by '.' (default app_name) |
| proc_id_field | string | sets proc id in syslog from field in fluentd, delimited by '.' (default proc_id) |
Expand Down
2 changes: 1 addition & 1 deletion lib/fluent-plugin-syslog_rfc5424/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module FluentSyslog5424OutputPlugin
VERSION = "0.9.0.rc.3"
VERSION = "0.9.1.rc.1"
end
3 changes: 3 additions & 0 deletions lib/fluent/plugin/formatter_syslog_rfc5424.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ class FormatterSyslogRFC5424 < Formatter
Fluent::Plugin.register_formatter('syslog_rfc5424', self)

config_param :rfc6587_message_size, :bool, default: true
config_param :priority_field, :string, default: "priority"
config_param :hostname_field, :string, default: "hostname"
config_param :app_name_field, :string, default: "app_name"
config_param :proc_id_field, :string, default: "proc_id"
Expand All @@ -15,6 +16,7 @@ class FormatterSyslogRFC5424 < Formatter

def configure(conf)
super
@priority_field_array = @priority_field.split(".")
@hostname_field_array = @hostname_field.split(".")
@app_name_field_array = @app_name_field.split(".")
@proc_id_field_array = @proc_id_field.split(".")
Expand All @@ -28,6 +30,7 @@ def format(tag, time, record)
log.debug(record.map { |k, v| "#{k}=#{v}" }.join('&'))

msg = RFC5424::Formatter.format(
priority: record.dig(*@priority_field_array) || 14,
log: record.dig(*@log_field_array) || "-",
timestamp: time,
hostname: record.dig(*@hostname_field_array) || "-",
Expand Down