fluent-plugin-syslog_rfc5424 0.7.3 → 0.8.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
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: '009a1a4ccbd3c13697a59f12a11e4d73cabc42f94952039d008b8cd603d9027b'
|
4
|
+
data.tar.gz: 5fd2d64072fedf505368ea06aafaf890e8a9a306e3b624d45bb4c4ec7445d5f5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 010cab1c657e5355c56e588892314110c203c3825b5df65b695beb772e7246d92470d98f48f7d53bdd1b98a080724bb94d5df48e76a9618ef523a4ebd80a4626
|
7
|
+
data.tar.gz: 893db812e15131e839c386d4d5b8fddaf001eb17e4242c038084ed108e438181ba2dd2f2e1c9c7b0f07d6e98f9f288ca790e040efbb035463b8d4f4873e96d53
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.5.7
|
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 =
|
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", "~>
|
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"
|
@@ -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
|
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
|
@@ -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.
|
4
|
+
version: 0.8.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-
|
11
|
+
date: 2020-04-13 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: '
|
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: '
|
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
|
@@ -150,7 +151,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
150
151
|
version: '0'
|
151
152
|
requirements: []
|
152
153
|
rubyforge_project:
|
153
|
-
rubygems_version: 2.6.
|
154
|
+
rubygems_version: 2.7.6.2
|
154
155
|
signing_key:
|
155
156
|
specification_version: 4
|
156
157
|
summary: FluentD output plugin to send messages via rfc5424
|