fluent-plugin-systemd 0.1.1 → 0.2.0
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 +4 -4
- data/README.md +36 -13
- data/lib/fluent/plugin/in_systemd.rb +17 -8
- data/lib/fluent/plugin/systemd/pos_writer.rb +26 -8
- metadata +1 -14
- data/Gemfile +0 -3
- data/Gemfile.lock +0 -67
- data/Rakefile +0 -31
- data/Vagrantfile +0 -71
- data/fluent-plugin-systemd.gemspec +0 -28
- data/pkg/fluent-plugin-systemd-0.0.3.gem +0 -0
- data/pkg/fluent-plugin-systemd-0.0.4.gem +0 -0
- data/pkg/fluent-plugin-systemd-0.0.5.gem +0 -0
- data/pkg/fluent-plugin-systemd-0.0.6.gem +0 -0
- data/pkg/fluent-plugin-systemd-0.1.0.gem +0 -0
- data/pkg/fluent-plugin-systemd-0.1.1.pre.gem +0 -0
- data/pkg/fluent-plugin-systemd-0.1.1.pre2.gem +0 -0
- data/pkg/fluent-plugin-systemd-0.1.1.pre3.gem +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 07f12e01a1d81c731f44477a051807042230adfa
|
4
|
+
data.tar.gz: 8717ea703cd39fb947af86b5773a68de5b55c040
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 92b3275665979af1a9d691f05acdc65a88fd88b062c6224673cde0c691c9c7a4376a1c97c96c7e1dc9cc54f224fe27e7c39600bc0b6307c88ad182e442971520
|
7
|
+
data.tar.gz: 110c2d6ff7ebeac0eb96ceaf0d470d5bdfdf5da2e4556f8b2fc98b213e08b87553d231073f2828a5050dc88437f307e2846cea0ebfd39c131465a34b83123e5e
|
data/README.md
CHANGED
@@ -6,8 +6,8 @@
|
|
6
6
|
|
7
7
|
|
8
8
|
|fluent-plugin-systemd|fluentd|td-agent|ruby|
|
9
|
-
|
10
|
-
| 0.
|
9
|
+
|----|----|----|----|
|
10
|
+
| 0.2.x | >= 0.14.11, < 2 | 3 | >= 2.1 |
|
11
11
|
| 0.0.x | ~> 0.12.0 | 2 | >= 1.9 |
|
12
12
|
|
13
13
|
* The 0.1.x series is developed from this branch (master)
|
@@ -21,11 +21,11 @@
|
|
21
21
|
|
22
22
|
Simply use RubyGems:
|
23
23
|
|
24
|
-
gem install fluent-plugin-systemd -v 0.
|
24
|
+
gem install fluent-plugin-systemd -v 0.2.0
|
25
25
|
|
26
|
-
|
26
|
+
or
|
27
27
|
|
28
|
-
td-agent-gem install fluent-plugin-systemd -v 0.
|
28
|
+
td-agent-gem install fluent-plugin-systemd -v 0.2.0
|
29
29
|
|
30
30
|
## Configuration
|
31
31
|
|
@@ -33,37 +33,59 @@ Simply use RubyGems:
|
|
33
33
|
@type systemd
|
34
34
|
path /var/log/journal
|
35
35
|
filters [{ "_SYSTEMD_UNIT": "kube-proxy.service" }]
|
36
|
-
|
36
|
+
<storage>
|
37
|
+
@type local
|
38
|
+
persistent true
|
39
|
+
path kube-proxy.pos
|
40
|
+
</storage>
|
37
41
|
tag kube-proxy
|
38
42
|
read_from_head true
|
39
43
|
</source>
|
40
44
|
|
41
|
-
|
45
|
+
<match kube-proxy>
|
46
|
+
@type stdout
|
47
|
+
</match>
|
48
|
+
|
49
|
+
**`path`**
|
42
50
|
|
43
51
|
Path to the systemd journal, defaults to `/var/log/journal`
|
44
52
|
|
45
|
-
|
53
|
+
**`filters`**
|
46
54
|
|
47
55
|
Array of filters, see [here](http://www.rubydoc.info/gems/systemd-journal/Systemd%2FJournal%2FFilterable%3Afilter) for further
|
48
56
|
documentation, defaults to no filtering.
|
49
57
|
|
50
|
-
|
58
|
+
**`pos_file`**
|
59
|
+
|
60
|
+
_This parameter is deprecated and will be removed in favour of storage in v1.0._
|
61
|
+
|
51
62
|
|
52
63
|
Path to pos file, stores the journald cursor. File is created if does not exist.
|
53
64
|
|
54
|
-
|
65
|
+
**`storage`**
|
66
|
+
|
67
|
+
Configuration for a [storage plugin](http://docs.fluentd.org/v0.14/articles/storage-plugin-overview) used to store the journald cursor.
|
68
|
+
|
69
|
+
_Upgrading from `pos_file`_
|
70
|
+
|
71
|
+
If `pos_file` is specified in addition to a storage plugin with persistent set to true, the cursor will be
|
72
|
+
copied from the `pos_file` on startup, and the old `pos_file` removed.
|
73
|
+
|
74
|
+
**`read_from_head`**
|
55
75
|
|
56
76
|
If true reads all available journal from head, otherwise starts reading from tail,
|
57
77
|
ignored if pos file exists (and is valid). Defaults to false.
|
58
78
|
|
59
|
-
|
79
|
+
**`strip_underscores`**
|
60
80
|
|
61
81
|
If true strips underscores from the beginning of systemd field names.
|
62
82
|
May be useful if outputting to kibana, as underscore prefixed fields are unindexed there.
|
63
83
|
|
64
|
-
|
84
|
+
**`tag`**
|
85
|
+
|
86
|
+
_Required_
|
65
87
|
|
66
|
-
|
88
|
+
A tag that will be added to events generated by this input.
|
67
89
|
|
68
90
|
## Example
|
69
91
|
|
@@ -99,3 +121,4 @@ Many thanks to our fantastic contributors
|
|
99
121
|
* [Richard Megginson](https://github.com/richm)
|
100
122
|
* [Masahiro Nakagawa](https://github.com/repeatedly)
|
101
123
|
* [Hiroshi Hatake](https://github.com/cosmo0920)
|
124
|
+
* [neko-neko](https://github.com/neko-neko)
|
@@ -7,29 +7,37 @@ module Fluent
|
|
7
7
|
class SystemdInput < Input
|
8
8
|
Fluent::Plugin.register_input("systemd", self)
|
9
9
|
|
10
|
-
helpers :timer
|
10
|
+
helpers :timer, :storage
|
11
|
+
|
12
|
+
DEFAULT_STORAGE_TYPE = "local".freeze
|
11
13
|
|
12
14
|
config_param :path, :string, default: "/var/log/journal"
|
13
15
|
config_param :filters, :array, default: []
|
14
|
-
config_param :pos_file, :string, default: nil
|
16
|
+
config_param :pos_file, :string, default: nil, deprecated: "Use <storage> section with `persistent: true' instead"
|
15
17
|
config_param :read_from_head, :bool, default: false
|
16
18
|
config_param :strip_underscores, :bool, default: false
|
17
19
|
config_param :tag, :string
|
18
20
|
|
21
|
+
config_section :storage do
|
22
|
+
config_set_default :usage, "positions"
|
23
|
+
config_set_default :@type, DEFAULT_STORAGE_TYPE
|
24
|
+
config_set_default :persistent, false
|
25
|
+
end
|
26
|
+
|
19
27
|
def configure(conf)
|
20
28
|
super
|
21
|
-
@
|
29
|
+
@pos_storage = PosWriter.new(@pos_file, storage_create(usage: "positions"))
|
22
30
|
@journal = nil
|
23
31
|
end
|
24
32
|
|
25
33
|
def start
|
26
34
|
super
|
27
|
-
@
|
35
|
+
@pos_storage.start
|
28
36
|
timer_execute(:in_systemd_emit_worker, 1, &method(:run))
|
29
37
|
end
|
30
38
|
|
31
39
|
def shutdown
|
32
|
-
@
|
40
|
+
@pos_storage.shutdown
|
33
41
|
super
|
34
42
|
end
|
35
43
|
|
@@ -49,10 +57,11 @@ module Fluent
|
|
49
57
|
end
|
50
58
|
|
51
59
|
def seek
|
52
|
-
|
60
|
+
cursor = @pos_storage.get(:journal)
|
61
|
+
seek_to(cursor || read_from)
|
53
62
|
rescue Systemd::JournalError
|
54
63
|
log.warn(
|
55
|
-
"Could not seek to cursor #{
|
64
|
+
"Could not seek to cursor #{cursor} found in pos file: #{@pos_storage.path}, " \
|
56
65
|
"falling back to reading from #{read_from}",
|
57
66
|
)
|
58
67
|
seek_to(read_from)
|
@@ -96,7 +105,7 @@ module Fluent
|
|
96
105
|
def watch
|
97
106
|
while @journal.move_next
|
98
107
|
yield @journal.current_entry
|
99
|
-
@
|
108
|
+
@pos_storage.put(:journal, @journal.cursor)
|
100
109
|
end
|
101
110
|
end
|
102
111
|
end
|
@@ -4,15 +4,27 @@ module Fluent
|
|
4
4
|
module Plugin
|
5
5
|
class SystemdInput < Input
|
6
6
|
class PosWriter
|
7
|
-
def initialize(pos_file)
|
7
|
+
def initialize(pos_file, storage)
|
8
8
|
@path = pos_file
|
9
9
|
@lock = Mutex.new
|
10
|
+
@storage = storage
|
10
11
|
@cursor = nil
|
11
12
|
@written_cursor = nil
|
12
13
|
setup
|
13
14
|
end
|
14
15
|
|
15
|
-
|
16
|
+
def get(key)
|
17
|
+
@storage ? @storage.get(key) : @cursor
|
18
|
+
end
|
19
|
+
|
20
|
+
def put(key, cursor)
|
21
|
+
return @storage.put(key, cursor) if @storage
|
22
|
+
@lock.synchronize { @cursor = cursor }
|
23
|
+
end
|
24
|
+
|
25
|
+
def path
|
26
|
+
@path || @storage.path
|
27
|
+
end
|
16
28
|
|
17
29
|
def start
|
18
30
|
return unless @path
|
@@ -27,15 +39,21 @@ module Fluent
|
|
27
39
|
write_pos
|
28
40
|
end
|
29
41
|
|
30
|
-
def update(c)
|
31
|
-
@lock.synchronize { @cursor = c }
|
32
|
-
end
|
33
|
-
|
34
42
|
private
|
35
43
|
|
36
44
|
def setup
|
37
|
-
|
38
|
-
|
45
|
+
if @storage.persistent
|
46
|
+
migrate_to_storage if @path && File.exist?(@path)
|
47
|
+
elsif @path
|
48
|
+
@cursor = IO.read(@path).chomp if File.exist?(@path)
|
49
|
+
@storage = nil
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def migrate_to_storage
|
54
|
+
@storage.put(:journal, IO.read(@path).chomp)
|
55
|
+
File.delete(@path)
|
56
|
+
@path = nil
|
39
57
|
end
|
40
58
|
|
41
59
|
def work
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-systemd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ed Robinson
|
@@ -107,23 +107,10 @@ executables: []
|
|
107
107
|
extensions: []
|
108
108
|
extra_rdoc_files: []
|
109
109
|
files:
|
110
|
-
- Gemfile
|
111
|
-
- Gemfile.lock
|
112
110
|
- LICENCE
|
113
111
|
- README.md
|
114
|
-
- Rakefile
|
115
|
-
- Vagrantfile
|
116
|
-
- fluent-plugin-systemd.gemspec
|
117
112
|
- lib/fluent/plugin/in_systemd.rb
|
118
113
|
- lib/fluent/plugin/systemd/pos_writer.rb
|
119
|
-
- pkg/fluent-plugin-systemd-0.0.3.gem
|
120
|
-
- pkg/fluent-plugin-systemd-0.0.4.gem
|
121
|
-
- pkg/fluent-plugin-systemd-0.0.5.gem
|
122
|
-
- pkg/fluent-plugin-systemd-0.0.6.gem
|
123
|
-
- pkg/fluent-plugin-systemd-0.1.0.gem
|
124
|
-
- pkg/fluent-plugin-systemd-0.1.1.pre.gem
|
125
|
-
- pkg/fluent-plugin-systemd-0.1.1.pre2.gem
|
126
|
-
- pkg/fluent-plugin-systemd-0.1.1.pre3.gem
|
127
114
|
homepage: https://github.com/reevoo/fluent-plugin-systemd
|
128
115
|
licenses:
|
129
116
|
- MIT
|
data/Gemfile
DELETED
data/Gemfile.lock
DELETED
@@ -1,67 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
fluent-plugin-systemd (0.1.1)
|
5
|
-
fluentd (>= 0.14.11, < 2)
|
6
|
-
systemd-journal (~> 1.2)
|
7
|
-
|
8
|
-
GEM
|
9
|
-
remote: https://rubygems.org/
|
10
|
-
specs:
|
11
|
-
ast (2.3.0)
|
12
|
-
astrolabe (1.3.1)
|
13
|
-
parser (~> 2.2)
|
14
|
-
cool.io (1.4.5)
|
15
|
-
ffi (1.9.17)
|
16
|
-
fluentd (0.14.11)
|
17
|
-
cool.io (~> 1.4.5)
|
18
|
-
http_parser.rb (>= 0.5.1, < 0.7.0)
|
19
|
-
msgpack (>= 0.7.0, < 2.0.0)
|
20
|
-
serverengine (>= 2.0.4, < 3.0.0)
|
21
|
-
sigdump (~> 0.2.2)
|
22
|
-
strptime (~> 0.1.7)
|
23
|
-
tzinfo (~> 1.0)
|
24
|
-
tzinfo-data (~> 1.0)
|
25
|
-
yajl-ruby (~> 1.0)
|
26
|
-
http_parser.rb (0.6.0)
|
27
|
-
msgpack (1.0.2)
|
28
|
-
parser (2.3.3.1)
|
29
|
-
ast (~> 2.2)
|
30
|
-
powerpack (0.0.9)
|
31
|
-
rainbow (2.2.1)
|
32
|
-
rake (12.0.0)
|
33
|
-
reevoocop (0.0.9)
|
34
|
-
rubocop (= 0.28.0)
|
35
|
-
rubocop (0.28.0)
|
36
|
-
astrolabe (~> 1.3)
|
37
|
-
parser (>= 2.2.0.pre.7, < 3.0)
|
38
|
-
powerpack (~> 0.0.6)
|
39
|
-
rainbow (>= 1.99.1, < 3.0)
|
40
|
-
ruby-progressbar (~> 1.4)
|
41
|
-
ruby-progressbar (1.8.1)
|
42
|
-
serverengine (2.0.4)
|
43
|
-
sigdump (~> 0.2.2)
|
44
|
-
sigdump (0.2.4)
|
45
|
-
strptime (0.1.9)
|
46
|
-
systemd-journal (1.2.3)
|
47
|
-
ffi (~> 1.9)
|
48
|
-
test-unit (2.5.5)
|
49
|
-
thread_safe (0.3.5)
|
50
|
-
tzinfo (1.2.2)
|
51
|
-
thread_safe (~> 0.1)
|
52
|
-
tzinfo-data (1.2016.10)
|
53
|
-
tzinfo (>= 1.0.0)
|
54
|
-
yajl-ruby (1.3.0)
|
55
|
-
|
56
|
-
PLATFORMS
|
57
|
-
ruby
|
58
|
-
|
59
|
-
DEPENDENCIES
|
60
|
-
bundler (~> 1.10)
|
61
|
-
fluent-plugin-systemd!
|
62
|
-
rake
|
63
|
-
reevoocop
|
64
|
-
test-unit (~> 2.5)
|
65
|
-
|
66
|
-
BUNDLED WITH
|
67
|
-
1.13.2
|
data/Rakefile
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
require "bundler/gem_tasks"
|
2
|
-
require "rake/testtask"
|
3
|
-
require "reevoocop/rake_task"
|
4
|
-
require "fileutils"
|
5
|
-
|
6
|
-
ReevooCop::RakeTask.new(:reevoocop)
|
7
|
-
|
8
|
-
Rake::TestTask.new(:test) do |t|
|
9
|
-
t.test_files = Dir["test/**/test_*.rb"]
|
10
|
-
end
|
11
|
-
|
12
|
-
task default: "docker:test"
|
13
|
-
task build: "docker:test"
|
14
|
-
task default: :reevoocop
|
15
|
-
|
16
|
-
namespace :docker do
|
17
|
-
distros = [:ubuntu, :"tdagent-ubuntu", :"tdagent-centos"]
|
18
|
-
task test: distros
|
19
|
-
|
20
|
-
distros.each do |distro|
|
21
|
-
task distro do
|
22
|
-
puts "testing on #{distro}"
|
23
|
-
begin
|
24
|
-
FileUtils.cp("test/docker/Dockerfile.#{distro}", "Dockerfile")
|
25
|
-
sh "docker build ."
|
26
|
-
ensure
|
27
|
-
FileUtils.rm("Dockerfile")
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
data/Vagrantfile
DELETED
@@ -1,71 +0,0 @@
|
|
1
|
-
# -*- mode: ruby -*-
|
2
|
-
# vi: set ft=ruby :
|
3
|
-
|
4
|
-
# All Vagrant configuration is done below. The "2" in Vagrant.configure
|
5
|
-
# configures the configuration version (we support older styles for
|
6
|
-
# backwards compatibility). Please don't change it unless you know what
|
7
|
-
# you're doing.
|
8
|
-
Vagrant.configure("2") do |config|
|
9
|
-
# The most common configuration options are documented and commented below.
|
10
|
-
# For a complete reference, please see the online documentation at
|
11
|
-
# https://docs.vagrantup.com.
|
12
|
-
|
13
|
-
# Every Vagrant development environment requires a box. You can search for
|
14
|
-
# boxes at https://atlas.hashicorp.com/search.
|
15
|
-
config.vm.box = "centos/7"
|
16
|
-
|
17
|
-
# Disable automatic box update checking. If you disable this, then
|
18
|
-
# boxes will only be checked for updates when the user runs
|
19
|
-
# `vagrant box outdated`. This is not recommended.
|
20
|
-
# config.vm.box_check_update = false
|
21
|
-
|
22
|
-
# Create a forwarded port mapping which allows access to a specific port
|
23
|
-
# within the machine from a port on the host machine. In the example below,
|
24
|
-
# accessing "localhost:8080" will access port 80 on the guest machine.
|
25
|
-
# config.vm.network "forwarded_port", guest: 80, host: 8080
|
26
|
-
|
27
|
-
# Create a private network, which allows host-only access to the machine
|
28
|
-
# using a specific IP.
|
29
|
-
# config.vm.network "private_network", ip: "192.168.33.10"
|
30
|
-
|
31
|
-
# Create a public network, which generally matched to bridged network.
|
32
|
-
# Bridged networks make the machine appear as another physical device on
|
33
|
-
# your network.
|
34
|
-
# config.vm.network "public_network"
|
35
|
-
|
36
|
-
# Share an additional folder to the guest VM. The first argument is
|
37
|
-
# the path on the host to the actual folder. The second argument is
|
38
|
-
# the path on the guest to mount the folder. And the optional third
|
39
|
-
# argument is a set of non-required options.
|
40
|
-
# config.vm.synced_folder "../data", "/vagrant_data"
|
41
|
-
|
42
|
-
# Provider-specific configuration so you can fine-tune various
|
43
|
-
# backing providers for Vagrant. These expose provider-specific options.
|
44
|
-
# Example for VirtualBox:
|
45
|
-
#
|
46
|
-
# config.vm.provider "virtualbox" do |vb|
|
47
|
-
# # Display the VirtualBox GUI when booting the machine
|
48
|
-
# vb.gui = true
|
49
|
-
#
|
50
|
-
# # Customize the amount of memory on the VM:
|
51
|
-
# vb.memory = "1024"
|
52
|
-
# end
|
53
|
-
#
|
54
|
-
# View the documentation for the provider you are using for more
|
55
|
-
# information on available options.
|
56
|
-
|
57
|
-
# Define a Vagrant Push strategy for pushing to Atlas. Other push strategies
|
58
|
-
# such as FTP and Heroku are also available. See the documentation at
|
59
|
-
# https://docs.vagrantup.com/v2/push/atlas.html for more information.
|
60
|
-
# config.push.define "atlas" do |push|
|
61
|
-
# push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME"
|
62
|
-
# end
|
63
|
-
|
64
|
-
# Enable provisioning with a shell script. Additional provisioners such as
|
65
|
-
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
|
66
|
-
# documentation for more information about their specific syntax and use.
|
67
|
-
# config.vm.provision "shell", inline: <<-SHELL
|
68
|
-
# apt-get update
|
69
|
-
# apt-get install -y apache2
|
70
|
-
# SHELL
|
71
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
|
3
|
-
lib = File.expand_path("../lib", __FILE__)
|
4
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
-
|
6
|
-
Gem::Specification.new do |spec|
|
7
|
-
spec.name = "fluent-plugin-systemd"
|
8
|
-
spec.version = "0.1.1"
|
9
|
-
spec.authors = ["Ed Robinson"]
|
10
|
-
spec.email = ["ed@reevoo.com"]
|
11
|
-
|
12
|
-
spec.summary = "Input plugin to read from systemd journal."
|
13
|
-
spec.description = "This is a fluentd input plugin. It reads logs from the systemd journal."
|
14
|
-
spec.homepage = "https://github.com/reevoo/fluent-plugin-systemd"
|
15
|
-
spec.license = "MIT"
|
16
|
-
|
17
|
-
|
18
|
-
spec.files = Dir["**/**"].reject { |f| f.match(/^(test|spec|features)\//) }
|
19
|
-
spec.require_paths = ["lib"]
|
20
|
-
|
21
|
-
spec.add_development_dependency "bundler", "~> 1.10"
|
22
|
-
spec.add_development_dependency "rake"
|
23
|
-
spec.add_development_dependency "test-unit", "~> 2.5"
|
24
|
-
spec.add_development_dependency "reevoocop"
|
25
|
-
|
26
|
-
spec.add_runtime_dependency "fluentd", [">= 0.14.11", "< 2"]
|
27
|
-
spec.add_runtime_dependency "systemd-journal", "~> 1.2"
|
28
|
-
end
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|