fluent-plugin-syslog_rfc5424 0.6.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3f3e58806594ab10187d2c6909a9ec386b7644dc
4
- data.tar.gz: 126da79f294d6843ce53f4b87a8ae2c7caf98a64
3
+ metadata.gz: f6c2a7e27ac573735e5cdfb190c0ebe9b5be330b
4
+ data.tar.gz: 6c8c1dd62b0dac4917b751e2458a21dee022aa52
5
5
  SHA512:
6
- metadata.gz: a565e5a16f4b8d9dc4536c116ca37b8059a620c5fa8efa3e2ef2c314ba89ba862e76bf89953cb9e122f951638622559db49146e8421742c6f96412d8de05aee3
7
- data.tar.gz: 17917ed6c9720e60e2cbdd4e4776dcb5736f2feddfe77dcefa021f8c8803b034da2078ec7fc40b8eaa29cddfdfc07a8e0570d0b92370fe383c8b5b9d4608572f
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.6.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("kubernetes", "labels", "cloudfoundry.org/app_guid") || "-",
21
- proc_id: record.dig("kubernetes", "pod_id") || "-"
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", "kubernetes" => {"labels" => { "cloudfoundry.org/app_guid" => "custom-value"}}}
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", "kubernetes" => {"pod_id" => "custom-value"}}
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-syslog_rfc5424
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pivotal