fluent-plugin-syslog_rfc5424 0.7.3 → 0.9.0.rc.5

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
- SHA1:
3
- metadata.gz: 678c7679f9c40aed9163e9a96c81ab956cfb8ddb
4
- data.tar.gz: 20ff60bbf06f1780dc17c49e54ec05cc9bdae4b7
2
+ SHA256:
3
+ metadata.gz: 31bf4f10b1fa38ddf94b55a5ad78af18ba0f36841b70bc27313918a8db0c4f7e
4
+ data.tar.gz: ee070ebfe99860863df6c327dce8e2e8b00bc302eaee716f27f962bd3e9d8000
5
5
  SHA512:
6
- metadata.gz: 9bce27bd480431a126c9f493802ff438a25866c259adfa8366168f567e66e301f7a01c64e1409e21923a4c0e7588c7bad911a76a2e9785aa5c0088735b25a154
7
- data.tar.gz: 71080495b53c144288b384c20791889287e62d21686f7fd78c1b982d3ce629e07dbdc5749af0dfd48dc3d29365dbe0a928b157abff5cea25401f25ce3ce8c7e3
6
+ metadata.gz: 1c7fcf1449ec7560e10e214763c3f34032f5ef9482c12bedcfd11964435aa6d8329404e2933d2b818c2b726652831e9c8d9331e2446641ca297b88403f769320
7
+ data.tar.gz: 6bc6865390d7b6bc8983d002e55350fbfcedfa83d06e2144dec42b2dcf3d9ba53597d1c65cade67c01f49d20dcd35b481147e0ab813be16b93a052b6d556d869
@@ -1 +1 @@
1
- 2.4.2
1
+ 2.5.7
data/README.md CHANGED
@@ -1,9 +1,8 @@
1
1
  # FluentD Output & Formatter Plugins: Syslog RFC5424
2
2
 
3
- [![Build Status](https://travis-ci.org/cloudfoundry/fluent-plugin-syslog_rfc5424.svg?branch=master)](https://travis-ci.org/cloudfoundry/fluent-plugin-syslog_rfc5424)
3
+ [![Build Status](https://travis-ci.org/cloudfoundry/fluent-plugin-syslog_rfc5424.svg?branch=main)](https://travis-ci.org/cloudfoundry/fluent-plugin-syslog_rfc5424)
4
4
 
5
-
6
- Formatter plugin adheres to [RFC5424](https://tools.ietf.org/html/rfc5424).
5
+ Formatter plugin adheres to [RFC5424](https://tools.ietf.org/html/rfc5424).
7
6
 
8
7
  Output plugin adheres to [RFC6587](https://tools.ietf.org/html/rfc6587) and [RFC5424](https://tools.ietf.org/html/rfc5424).
9
8
 
@@ -54,9 +53,12 @@ Defaults to `syslog_rfc5424`
54
53
  | name |type | description |
55
54
  | -------------- | ------- | ------- |
56
55
  | rfc6587_message_size | boolean | prepends message length for syslog transmission (true by default) |
56
+ | hostname_field | string | sets host name in syslog from field in fluentd, delimited by '.' (default hostname) |
57
57
  | app_name_field | string | sets app name in syslog from field in fluentd, delimited by '.' (default app_name) |
58
58
  | proc_id_field | string | sets proc id in syslog from field in fluentd, delimited by '.' (default proc_id) |
59
-
59
+ | message_id_field | string | sets msg id in syslog from field in fluentd, delimited by '.' (default message_id) |
60
+ | structured_data_field | string | sets structured data in syslog from field in fluentd, delimited by '.' (default structured_data) |
61
+ | log_field | string | sets log in syslog from field in fluentd, delimited by '.' (default log) |
60
62
 
61
63
  ## Formatter Usage
62
64
 
@@ -71,7 +73,6 @@ Defaults to `syslog_rfc5424`
71
73
  </match>
72
74
  ```
73
75
 
74
-
75
76
  ## Development
76
77
 
77
78
  After checking out the repo, run `bundle install` to install dependencies. Then, run `bundle exec rake` to run the tests. You can also run `bundle console` for an interactive prompt that will allow you to experiment.
data/Rakefile CHANGED
@@ -1,5 +1,6 @@
1
1
  require "bundler/gem_tasks"
2
2
  require 'rake/testtask'
3
+ require 'fluent-plugin-syslog_rfc5424/version'
3
4
 
4
5
  Rake::TestTask.new(:test) do |test|
5
6
  test.libs << "lib" << "test"
@@ -8,3 +9,7 @@ Rake::TestTask.new(:test) do |test|
8
9
  end
9
10
 
10
11
  task default: :test
12
+
13
+ task :version do
14
+ puts FluentSyslog5424OutputPlugin::VERSION
15
+ end
@@ -1,10 +1,10 @@
1
1
 
2
2
  lib = File.expand_path("../lib", __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
-
4
+ require 'fluent-plugin-syslog_rfc5424/version'
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "fluent-plugin-syslog_rfc5424"
7
- spec.version = "0.7.3"
7
+ spec.version = FluentSyslog5424OutputPlugin::VERSION
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"
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.require_paths = ["lib"]
19
19
 
20
20
  spec.add_development_dependency "bundler", "~> 2.0"
21
- spec.add_development_dependency "rake", "~> 10.0"
21
+ spec.add_development_dependency "rake", "~> 13.0"
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"
@@ -0,0 +1,3 @@
1
+ module FluentSyslog5424OutputPlugin
2
+ VERSION = "0.9.0.rc.5"
3
+ end
@@ -6,13 +6,21 @@ module Fluent
6
6
  Fluent::Plugin.register_formatter('syslog_rfc5424', self)
7
7
 
8
8
  config_param :rfc6587_message_size, :bool, default: true
9
+ config_param :hostname_field, :string, default: "hostname"
9
10
  config_param :app_name_field, :string, default: "app_name"
10
11
  config_param :proc_id_field, :string, default: "proc_id"
12
+ config_param :message_id_field, :string, default: "message_id"
13
+ config_param :structured_data_field, :string, default: "structured_data"
14
+ config_param :log_field, :string, default: "log"
11
15
 
12
16
  def configure(conf)
13
17
  super
18
+ @hostname_field_array = @hostname_field.split(".")
14
19
  @app_name_field_array = @app_name_field.split(".")
15
20
  @proc_id_field_array = @proc_id_field.split(".")
21
+ @message_id_field_array = @message_id_field.split(".")
22
+ @structured_data_field_array = @structured_data_field.split(".")
23
+ @log_field_array = @log_field.split(".")
16
24
  end
17
25
 
18
26
  def format(tag, time, record)
@@ -20,10 +28,13 @@ module Fluent
20
28
  log.debug(record.map { |k, v| "#{k}=#{v}" }.join('&'))
21
29
 
22
30
  msg = RFC5424::Formatter.format(
23
- log: record['log'],
31
+ log: record.dig(*@log_field_array) || "-",
24
32
  timestamp: time,
33
+ hostname: record.dig(*@hostname_field_array) || "-",
25
34
  app_name: record.dig(*@app_name_field_array) || "-",
26
- proc_id: record.dig(*@proc_id_field_array) || "-"
35
+ proc_id: record.dig(*@proc_id_field_array) || "-",
36
+ msg_id: record.dig(*@message_id_field_array) || "-",
37
+ sd: record.dig(*@structured_data_field_array) || "-"
27
38
  )
28
39
 
29
40
  log.debug("RFC 5424 Message")
@@ -35,4 +46,4 @@ module Fluent
35
46
  end
36
47
  end
37
48
  end
38
- end
49
+ end
@@ -23,6 +23,10 @@ module Fluent
23
23
  @formatter = formatter_create
24
24
  end
25
25
 
26
+ def multi_workers_ready?
27
+ true
28
+ end
29
+
26
30
  def write(chunk)
27
31
  socket = find_or_create_socket(@transport.to_sym, @host, @port)
28
32
  tag = chunk.metadata.tag
@@ -65,6 +65,54 @@ class FormatterSyslogRFC5424Test < Test::Unit::TestCase
65
65
  formatter_driver.instance.format(tag, time, record)
66
66
  end
67
67
 
68
+ def test_format_with_log_field
69
+ formatter_driver = create_driver %(
70
+ @type syslog_rfc5424
71
+ rfc6587_message_size false
72
+ log_field example.custom_field
73
+ )
74
+ tag = "test-formatter"
75
+ time = Fluent::EventTime.new(0, 123456000)
76
+ record = {"log" => "test-log", "example" => {"custom_field" => "custom-value"}}
77
+
78
+ formatted_message = "<14>1 1970-01-01T00:00:00.123456+00:00 - - - - - custom-value\n"
79
+ message_size = formatted_message.length
80
+ assert_equal "#{formatted_message}",
81
+ formatter_driver.instance.format(tag, time, record)
82
+ end
83
+
84
+ def test_format_with_structured_data
85
+ formatter_driver = create_driver %(
86
+ @type syslog_rfc5424
87
+ rfc6587_message_size false
88
+ structured_data_field example.custom_field
89
+ )
90
+ tag = "test-formatter"
91
+ time = Fluent::EventTime.new(0, 123456000)
92
+ record = {"log" => "test-log", "example" => {"custom_field" => "custom-value"}}
93
+
94
+ formatted_message = "<14>1 1970-01-01T00:00:00.123456+00:00 - - - - custom-value test-log\n"
95
+ message_size = formatted_message.length
96
+ assert_equal "#{formatted_message}",
97
+ formatter_driver.instance.format(tag, time, record)
98
+ end
99
+
100
+ def test_format_with_hostname
101
+ formatter_driver = create_driver %(
102
+ @type syslog_rfc5424
103
+ rfc6587_message_size false
104
+ hostname_field example.custom_field
105
+ )
106
+ tag = "test-formatter"
107
+ time = Fluent::EventTime.new(0, 123456000)
108
+ record = {"log" => "test-log", "example" => {"custom_field" => "custom-value"}}
109
+
110
+ formatted_message = "<14>1 1970-01-01T00:00:00.123456+00:00 custom-value - - - - test-log\n"
111
+ message_size = formatted_message.length
112
+ assert_equal "#{formatted_message}",
113
+ formatter_driver.instance.format(tag, time, record)
114
+ end
115
+
68
116
  def test_format_with_proc_id
69
117
  formatter_driver = create_driver %(
70
118
  @type syslog_rfc5424
@@ -81,5 +129,20 @@ class FormatterSyslogRFC5424Test < Test::Unit::TestCase
81
129
  formatter_driver.instance.format(tag, time, record)
82
130
  end
83
131
 
132
+ def test_format_with_message_id
133
+ formatter_driver = create_driver %(
134
+ @type syslog_rfc5424
135
+ rfc6587_message_size false
136
+ message_id_field example.custom_field
137
+ )
138
+ tag = "test-formatter"
139
+ time = Fluent::EventTime.new(0, 123456000)
140
+ record = {"log" => "test-log", "example" => {"custom_field" => "custom-value"}}
141
+
142
+ formatted_message = "<14>1 1970-01-01T00:00:00.123456+00:00 - - - custom-value - test-log\n"
143
+ message_size = formatted_message.length
144
+ assert_equal "#{formatted_message}",
145
+ formatter_driver.instance.format(tag, time, record)
146
+ end
84
147
 
85
- end
148
+ end
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.7.3
4
+ version: 0.9.0.rc.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pivotal
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-02-04 00:00:00.000000000 Z
11
+ date: 2020-10-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '10.0'
33
+ version: '13.0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '10.0'
40
+ version: '13.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: test-unit
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -123,6 +123,7 @@ files:
123
123
  - README.md
124
124
  - Rakefile
125
125
  - fluent-plugin-syslog_rfc5424.gemspec
126
+ - lib/fluent-plugin-syslog_rfc5424/version.rb
126
127
  - lib/fluent/plugin/formatter_syslog_rfc5424.rb
127
128
  - lib/fluent/plugin/out_syslog_rfc5424.rb
128
129
  - lib/rfc5424/formatter.rb
@@ -145,12 +146,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
145
146
  version: '0'
146
147
  required_rubygems_version: !ruby/object:Gem::Requirement
147
148
  requirements:
148
- - - ">="
149
+ - - ">"
149
150
  - !ruby/object:Gem::Version
150
- version: '0'
151
+ version: 1.3.1
151
152
  requirements: []
152
- rubyforge_project:
153
- rubygems_version: 2.6.13
153
+ rubygems_version: 3.1.4
154
154
  signing_key:
155
155
  specification_version: 4
156
156
  summary: FluentD output plugin to send messages via rfc5424