fluent-plugin-syslog_rfc5424 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f6c2a7e27ac573735e5cdfb190c0ebe9b5be330b
|
4
|
+
data.tar.gz: 6c8c1dd62b0dac4917b751e2458a21dee022aa52
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c7766465f1c7aa0f37e4e67cdc3eda168b1808ca8e1aada5b42c6fa26e2319ab6ca0dde93bc3616ef72fa87a0423196139e40bd90573e62b2ac4d06fe01d2ee8
|
7
|
+
data.tar.gz: '0238772ac572669f1194d68cf0b9e65d1108bbbc3a0ca08d88def67863de93aab8fd1de83ff23bd91ef31c983c3e8226d3111dcd5fc85d2ebd3ce578c56729f6'
|
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "fluent-plugin-syslog_rfc5424"
|
7
|
-
spec.version = "0.
|
7
|
+
spec.version = "0.7.0"
|
8
8
|
spec.authors = ["Pivotal"]
|
9
9
|
spec.email = %w(cf-loggregator@pivotal.io)
|
10
10
|
spec.homepage = "https://github.com/cloudfoundry/fluent-plugin-syslog_rfc5424"
|
@@ -6,6 +6,14 @@ module Fluent
|
|
6
6
|
Fluent::Plugin.register_formatter('syslog_rfc5424', self)
|
7
7
|
|
8
8
|
config_param :rfc6587_message_size, :bool, default: false
|
9
|
+
config_param :app_name_field, :string, default: "app_name"
|
10
|
+
config_param :proc_id_field, :string, default: "proc_id"
|
11
|
+
|
12
|
+
def configure(conf)
|
13
|
+
super
|
14
|
+
@app_name_field_array = @app_name_field.split(".")
|
15
|
+
@proc_id_field_array = @proc_id_field.split(".")
|
16
|
+
end
|
9
17
|
|
10
18
|
def format(tag, time, record)
|
11
19
|
log.debug("Tag")
|
@@ -17,8 +25,8 @@ module Fluent
|
|
17
25
|
msg = RFC5424::Formatter.format(
|
18
26
|
log: record['log'],
|
19
27
|
timestamp: time,
|
20
|
-
app_name: record.dig(
|
21
|
-
proc_id: record.dig(
|
28
|
+
app_name: record.dig(*@app_name_field_array) || "-",
|
29
|
+
proc_id: record.dig(*@proc_id_field_array) || "-"
|
22
30
|
)
|
23
31
|
|
24
32
|
log.debug("RFC 5424 Message")
|
@@ -51,10 +51,11 @@ class FormatterSyslogRFC5424Test < Test::Unit::TestCase
|
|
51
51
|
def test_format_with_app_name
|
52
52
|
formatter_driver = create_driver %(
|
53
53
|
@type syslog_rfc5424
|
54
|
+
app_name_field example.custom_field
|
54
55
|
)
|
55
56
|
tag = "test-formatter"
|
56
57
|
time = Fluent::EventTime.new(0, 123456000)
|
57
|
-
record = {"log" => "test-log", "
|
58
|
+
record = {"log" => "test-log", "example" => {"custom_field" => "custom-value"}}
|
58
59
|
|
59
60
|
formatted_message = "<14>1 1970-01-01T00:00:00.123456+00:00 - custom-value - - - test-log"
|
60
61
|
message_size = formatted_message.length
|
@@ -65,10 +66,11 @@ class FormatterSyslogRFC5424Test < Test::Unit::TestCase
|
|
65
66
|
def test_format_with_proc_id
|
66
67
|
formatter_driver = create_driver %(
|
67
68
|
@type syslog_rfc5424
|
69
|
+
proc_id_field example.custom_field
|
68
70
|
)
|
69
71
|
tag = "test-formatter"
|
70
72
|
time = Fluent::EventTime.new(0, 123456000)
|
71
|
-
record = {"log" => "test-log", "
|
73
|
+
record = {"log" => "test-log", "example" => {"custom_field" => "custom-value"}}
|
72
74
|
|
73
75
|
formatted_message = "<14>1 1970-01-01T00:00:00.123456+00:00 - - custom-value - - test-log"
|
74
76
|
message_size = formatted_message.length
|