fluent-plugin-systemd 1.0.2 → 1.0.3
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 +5 -5
- data/README.md +5 -4
- data/lib/fluent/plugin/in_systemd.rb +5 -0
- data/lib/fluent/plugin/systemd/entry_mutator.rb +7 -1
- metadata +14 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 5fd5812366214998e6e503dc83b4fa502a5787cb6574ace1a27a0579d5897376
|
4
|
+
data.tar.gz: 9555574c64af76aeb1cc4acfd5ef20a6eda63cea01ce4f5a45d2929707ef4466
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 84eccb26a0d0d9e52c8a257221f0076f1f502d535cfc383ef0e844ccab83a83d928d06fe8085c7fe963b2f10254efa024b290e8c2e7ac73fe9dec4fc7ae72b12
|
7
|
+
data.tar.gz: 3145138bb666f7c2a7f5287a0bd6c93fe8a3ba14741b9d356da00787139307db577e0f3bd5e6f1556c2f97987fad2dc4d501d98f79bb02a1f8befe04c529ba23
|
data/README.md
CHANGED
@@ -28,11 +28,11 @@ Join the #plugin-systemd channel on the [Fluentd Slack](http://slack.fluentd.org
|
|
28
28
|
|
29
29
|
Simply use RubyGems:
|
30
30
|
|
31
|
-
gem install fluent-plugin-systemd -v 1.0.
|
31
|
+
gem install fluent-plugin-systemd -v 1.0.3
|
32
32
|
|
33
33
|
or
|
34
34
|
|
35
|
-
td-agent-gem install fluent-plugin-systemd -v 1.0.
|
35
|
+
td-agent-gem install fluent-plugin-systemd -v 1.0.3
|
36
36
|
|
37
37
|
## Upgrading
|
38
38
|
|
@@ -47,8 +47,9 @@ If you are upgrading to version 1.0 from a previous version of this plugin take
|
|
47
47
|
matches [{ "_SYSTEMD_UNIT": "kubelet.service" }]
|
48
48
|
read_from_head true
|
49
49
|
|
50
|
-
<storage
|
50
|
+
<storage>
|
51
51
|
@type local
|
52
|
+
path /var/log/fluentd-journald-kubelet-cursor.json
|
52
53
|
</storage>
|
53
54
|
|
54
55
|
<entry>
|
@@ -84,7 +85,7 @@ description of this property and how to use it.
|
|
84
85
|
|
85
86
|
**`storage`**
|
86
87
|
|
87
|
-
Configuration for a [storage plugin](
|
88
|
+
Configuration for a [storage plugin](https://docs.fluentd.org/storage) used to store the journald cursor.
|
88
89
|
|
89
90
|
**`read_from_head`**
|
90
91
|
|
@@ -92,6 +92,7 @@ module Fluent
|
|
92
92
|
def seek_to(pos)
|
93
93
|
@journal.seek(pos)
|
94
94
|
return if pos == :head
|
95
|
+
|
95
96
|
if pos == :tail
|
96
97
|
@journal.move(-2)
|
97
98
|
else
|
@@ -105,6 +106,7 @@ module Fluent
|
|
105
106
|
|
106
107
|
def run
|
107
108
|
return unless @journal || init_journal
|
109
|
+
|
108
110
|
init_journal if @journal.wait(0) == :invalidate
|
109
111
|
watch do |entry|
|
110
112
|
emit(entry)
|
@@ -116,6 +118,7 @@ module Fluent
|
|
116
118
|
rescue Fluent::Plugin::Buffer::BufferOverflowError => e
|
117
119
|
retries ||= 0
|
118
120
|
raise e if retries > 10
|
121
|
+
|
119
122
|
retries += 1
|
120
123
|
sleep 1.5**retries + rand(0..3)
|
121
124
|
retry
|
@@ -129,6 +132,8 @@ module Fluent
|
|
129
132
|
|
130
133
|
def watch(&block)
|
131
134
|
yield_current_entry(&block) while @journal.move_next
|
135
|
+
rescue Systemd::JournalError => e
|
136
|
+
log.warn("Error moving to next Journal entry: #{e.class}: #{e.message}")
|
132
137
|
end
|
133
138
|
|
134
139
|
def yield_current_entry
|
@@ -67,6 +67,7 @@ module Fluent
|
|
67
67
|
# Expose config state as read-only instance properties of the mutator.
|
68
68
|
def method_missing(sym, *args)
|
69
69
|
return @opts[sym] if @opts.members.include?(sym)
|
70
|
+
|
70
71
|
super
|
71
72
|
end
|
72
73
|
|
@@ -80,6 +81,7 @@ module Fluent
|
|
80
81
|
def run(entry)
|
81
82
|
return entry.to_h if @no_transform
|
82
83
|
return map_fields(entry) if @opts.field_map_strict
|
84
|
+
|
83
85
|
format_fields(entry, map_fields(entry))
|
84
86
|
end
|
85
87
|
|
@@ -90,6 +92,7 @@ module Fluent
|
|
90
92
|
@map.each_with_object({}) do |(cstm, sysds), mapped|
|
91
93
|
vals = sysds.collect { |fld| entry[fld] }.compact
|
92
94
|
next if vals.empty? # systemd field does not exist in source entry
|
95
|
+
|
93
96
|
mapped[cstm] = join_if_needed(vals)
|
94
97
|
end
|
95
98
|
end
|
@@ -103,6 +106,7 @@ module Fluent
|
|
103
106
|
entry.each_with_object(mapped || {}) do |(fld, val), formatted_entry|
|
104
107
|
# don't mess with explicitly mapped fields
|
105
108
|
next if @map_src_fields.include?(fld)
|
109
|
+
|
106
110
|
fld = format_field_name(fld)
|
107
111
|
# account for mapping (appending) to an existing systemd field
|
108
112
|
formatted_entry[fld] = join_if_needed([val, mapped[fld]])
|
@@ -111,6 +115,7 @@ module Fluent
|
|
111
115
|
|
112
116
|
def warnings
|
113
117
|
return [] unless field_map_strict && field_map.empty?
|
118
|
+
|
114
119
|
'`field_map_strict` set to true with empty `field_map`, expect no fields'
|
115
120
|
end
|
116
121
|
|
@@ -119,6 +124,7 @@ module Fluent
|
|
119
124
|
def join_if_needed(values)
|
120
125
|
values.compact!
|
121
126
|
return values.first if values.length == 1
|
127
|
+
|
122
128
|
values.join(' ')
|
123
129
|
end
|
124
130
|
|
@@ -146,7 +152,7 @@ module Fluent
|
|
146
152
|
end
|
147
153
|
end
|
148
154
|
|
149
|
-
def validate_all_strings(arr, message, allow_nesting = false)
|
155
|
+
def validate_all_strings(arr, message, allow_nesting = false) # rubocop:disable Style/OptionalBooleanParameter
|
150
156
|
valid = arr.all? do |value|
|
151
157
|
value.is_a?(String) || allow_nesting && value.is_a?(Array) && value.all? { |key| key.is_a?(String) }
|
152
158
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-systemd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ed Robinson
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-04-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -44,28 +44,28 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '3.4'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '3.4'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rubocop
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - '='
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: 1.13.0
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - '='
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
68
|
+
version: 1.13.0
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: fluentd
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -92,14 +92,14 @@ dependencies:
|
|
92
92
|
requirements:
|
93
93
|
- - "~>"
|
94
94
|
- !ruby/object:Gem::Version
|
95
|
-
version: 1.
|
95
|
+
version: 1.4.2
|
96
96
|
type: :runtime
|
97
97
|
prerelease: false
|
98
98
|
version_requirements: !ruby/object:Gem::Requirement
|
99
99
|
requirements:
|
100
100
|
- - "~>"
|
101
101
|
- !ruby/object:Gem::Version
|
102
|
-
version: 1.
|
102
|
+
version: 1.4.2
|
103
103
|
description: This is a fluentd input plugin. It reads logs from the systemd journal.
|
104
104
|
email:
|
105
105
|
- edward-robinson@cookpad.com
|
@@ -116,7 +116,7 @@ homepage: https://github.com/reevoo/fluent-plugin-systemd
|
|
116
116
|
licenses:
|
117
117
|
- Apache-2.0
|
118
118
|
metadata: {}
|
119
|
-
post_install_message:
|
119
|
+
post_install_message:
|
120
120
|
rdoc_options: []
|
121
121
|
require_paths:
|
122
122
|
- lib
|
@@ -131,9 +131,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
131
131
|
- !ruby/object:Gem::Version
|
132
132
|
version: '0'
|
133
133
|
requirements: []
|
134
|
-
|
135
|
-
|
136
|
-
signing_key:
|
134
|
+
rubygems_version: 3.2.15
|
135
|
+
signing_key:
|
137
136
|
specification_version: 4
|
138
137
|
summary: Input plugin to read from systemd journal.
|
139
138
|
test_files: []
|