fluent-plugin-syslog_rfc5424 0.5.3 → 0.6.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: 978af580385e80f9a1cb5e743d35e6e014eba01c
4
- data.tar.gz: 7065e8650da7f66cbe7957b70c15c9a6b4307d15
3
+ metadata.gz: 3f3e58806594ab10187d2c6909a9ec386b7644dc
4
+ data.tar.gz: 126da79f294d6843ce53f4b87a8ae2c7caf98a64
5
5
  SHA512:
6
- metadata.gz: 27d241fa27e04065e6e7d4296a4c1a1c7e8d57f28b9f9c532a430e99740e4dbb5c3b22b309093347997966877867286c5e3e8e5d4663c00768b66bf9ef4f6d85
7
- data.tar.gz: 3e59568aa8b186c7cbc3441084399a41cfbbb6275f9deca84890c0646a5e36e7d7ccf8d4fee844b2b868e4e9c1d7dcfbc143dc9a23c67be8a88d25d52a206327
6
+ metadata.gz: a565e5a16f4b8d9dc4536c116ca37b8059a620c5fa8efa3e2ef2c314ba89ba862e76bf89953cb9e122f951638622559db49146e8421742c6f96412d8de05aee3
7
+ data.tar.gz: 17917ed6c9720e60e2cbdd4e4776dcb5736f2feddfe77dcefa021f8c8803b034da2078ec7fc40b8eaa29cddfdfc07a8e0570d0b92370fe383c8b5b9d4608572f
@@ -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.5.3"
7
+ spec.version = "0.6.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"
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
22
22
  spec.add_development_dependency "test-unit", "~> 3.3"
23
23
  spec.add_development_dependency "test-unit-rr", "~> 1.0"
24
24
  spec.add_development_dependency "pry", "~> 0.12"
25
- spec.add_development_dependency "minitest"
25
+ spec.add_development_dependency "minitest", "~> 5.8"
26
26
 
27
27
  spec.add_runtime_dependency "fluentd", "~> 1.7"
28
28
  end
@@ -17,8 +17,8 @@ module Fluent
17
17
  msg = RFC5424::Formatter.format(
18
18
  log: record['log'],
19
19
  timestamp: time,
20
- app_name: 'app-guid',
21
- proc_id: 'instance-id'
20
+ app_name: record.dig("kubernetes", "labels", "cloudfoundry.org/app_guid") || "-",
21
+ proc_id: record.dig("kubernetes", "pod_id") || "-"
22
22
  )
23
23
 
24
24
  log.debug("RFC 5424 Message")
@@ -17,7 +17,7 @@ class FormatterSyslogRFC5424Test < Test::Unit::TestCase
17
17
  tag = "test-formatter"
18
18
  time = Fluent::EventTime.new(0, 123456000)
19
19
  record = {"log" => "test-log"}
20
- assert_equal "<14>1 1970-01-01T00:00:00.123456+00:00 - app-name instance-id - - test-log",
20
+ assert_equal "<14>1 1970-01-01T00:00:00.123456+00:00 - - - - - test-log",
21
21
  formatter_driver.instance.format(tag, time, record)
22
22
  end
23
23
 
@@ -29,7 +29,7 @@ class FormatterSyslogRFC5424Test < Test::Unit::TestCase
29
29
  tag = "test-formatter"
30
30
  time = Fluent::EventTime.new(0, 123456000)
31
31
  record = {"log" => "test-log"}
32
- assert_equal "<14>1 1970-01-01T00:00:00.123456+00:00 - app-name instance-id - - test-log",
32
+ assert_equal "<14>1 1970-01-01T00:00:00.123456+00:00 - - - - - test-log",
33
33
  formatter_driver.instance.format(tag, time, record)
34
34
  end
35
35
 
@@ -42,9 +42,39 @@ class FormatterSyslogRFC5424Test < Test::Unit::TestCase
42
42
  time = Fluent::EventTime.new(0, 123456000)
43
43
  record = {"log" => "test-log"}
44
44
 
45
- formatted_message = "<14>1 1970-01-01T00:00:00.123456+00:00 - app-name instance-id - - test-log"
45
+ formatted_message = "<14>1 1970-01-01T00:00:00.123456+00:00 - - - - - test-log"
46
46
  message_size = formatted_message.length
47
47
  assert_equal "#{message_size} #{formatted_message}",
48
48
  formatter_driver.instance.format(tag, time, record)
49
49
  end
50
+
51
+ def test_format_with_app_name
52
+ formatter_driver = create_driver %(
53
+ @type syslog_rfc5424
54
+ )
55
+ tag = "test-formatter"
56
+ time = Fluent::EventTime.new(0, 123456000)
57
+ record = {"log" => "test-log", "kubernetes" => {"labels" => { "cloudfoundry.org/app_guid" => "custom-value"}}}
58
+
59
+ formatted_message = "<14>1 1970-01-01T00:00:00.123456+00:00 - custom-value - - - test-log"
60
+ message_size = formatted_message.length
61
+ assert_equal "#{formatted_message}",
62
+ formatter_driver.instance.format(tag, time, record)
63
+ end
64
+
65
+ def test_format_with_proc_id
66
+ formatter_driver = create_driver %(
67
+ @type syslog_rfc5424
68
+ )
69
+ tag = "test-formatter"
70
+ time = Fluent::EventTime.new(0, 123456000)
71
+ record = {"log" => "test-log", "kubernetes" => {"pod_id" => "custom-value"}}
72
+
73
+ formatted_message = "<14>1 1970-01-01T00:00:00.123456+00:00 - - custom-value - - test-log"
74
+ message_size = formatted_message.length
75
+ assert_equal "#{formatted_message}",
76
+ formatter_driver.instance.format(tag, time, record)
77
+ end
78
+
79
+
50
80
  end
@@ -5,7 +5,7 @@ class OutSyslogRFC5424Test < Test::Unit::TestCase
5
5
  def setup
6
6
  Fluent::Test.setup
7
7
  @time = Fluent::EventTime.new(0, 123456)
8
- @formatted_log = "68 <14>1 1970-01-01T00:00:00.000123+00:00 - app-name instance-id - - hi"
8
+ @formatted_log = "51 <14>1 1970-01-01T00:00:00.000123+00:00 - - - - - hi"
9
9
  end
10
10
 
11
11
  def create_driver(conf = CONFIG)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-syslog_rfc5424
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.3
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pivotal
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-01-13 00:00:00.000000000 Z
11
+ date: 2020-01-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -84,16 +84,16 @@ dependencies:
84
84
  name: minitest
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ">="
87
+ - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '0'
89
+ version: '5.8'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ">="
94
+ - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '0'
96
+ version: '5.8'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: fluentd
99
99
  requirement: !ruby/object:Gem::Requirement