logstash-input-journald 0.0.4 → 0.1.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: df132fdfd9561d73df5f49ac4c7408a15df597d3
4
- data.tar.gz: 3c34d90fecb45efee4fa6eadad7e37233539be51
3
+ metadata.gz: 7e3686bc41fa459b9c4117967e3b64c7527e9afa
4
+ data.tar.gz: f64c693cfbd8c8e3838e362cd678cfd209ad2586
5
5
  SHA512:
6
- metadata.gz: 355034993d7381aa58acead667a6e5a3fa79cae74387c1acb118e9c02f3ec321409467a5b2655a9d7673c068b2b0280779a28ecb3e87d8924f85d6931355f413
7
- data.tar.gz: 7350329c4f27f81c495fcd498f89fa5443110a10b50280f04c05463cd5ece4ebf85fbfb5fb6b5eae46991532489c45508ca83733aac24700d47d46405b5034fd
6
+ metadata.gz: 04a85cd6b19c337962d8df38d9ac9bded37db29409c5af74be4012ef585454a8baeaa6b595f3ee2b8c25a2d6fc607520e896e031e9a3f59f8d4e14607ba2147d
7
+ data.tar.gz: a624dd5815ae89466d5a7571e0a6614e31bda666b1b6e5c34c1925ece11b8aeebb6554176d30086dae8b8e75442b1d6d1aa5f7675f7171a5cdafa4e3bcb88d62
data/Gemfile CHANGED
@@ -1,3 +1,2 @@
1
1
  source 'https://rubygems.org'
2
- gemspec
3
- gem "logstash", :github => "elasticsearch/logstash", :branch => "1.5"
2
+ gemspec
data/README.md CHANGED
@@ -23,12 +23,20 @@ output {
23
23
 
24
24
  Install with
25
25
  ------------
26
+
27
+ From source
26
28
  ```
27
- git clone https://github.com/stuart-warren/logstash-input-journald.git
29
+ git clone https://github.com/logstash-plugins/logstash-input-journald.git
28
30
  cd logstash-input-journald
29
31
  gem build logstash-input-journald.gemspec
30
- sudo /path/to/logstash/bin/plugin install /path/to/git/logstash-input-journald/logstash-input-journald-0.0.1.gem
32
+ sudo /path/to/logstash/bin/plugin install /path/to/git/logstash-input-journald/logstash-input-journald-*.gem
33
+ ```
34
+
35
+ From rubygems
31
36
  ```
37
+ sudo /path/to/logstash/bin/plugin install logstash-input-journald
38
+ ```
39
+
32
40
  Sincedb
33
41
  ----
34
42
 
@@ -51,6 +51,11 @@ class LogStash::Inputs::Journald < LogStash::Inputs::Threadable
51
51
  #
52
52
  config :sincedb_write_interval, :validate => :number, :default => 15
53
53
 
54
+ # The max timeout in microsends to wait for new events from the journal.
55
+ # Set to -1 to wait indefinitely. Setting this to a large value will
56
+ # result in delayed shutdown of the plugin.
57
+ config :wait_timeout, :validate => :number, :default => 3000000
58
+
54
59
  public
55
60
  def register
56
61
  opts = {
@@ -115,7 +120,8 @@ class LogStash::Inputs::Journald < LogStash::Inputs::Threadable
115
120
  @journal.seek(@cursor)
116
121
  @journal.move_next # Without this, the last event will be read again
117
122
  end
118
- @journal.watch do |entry|
123
+
124
+ watch_journal do |entry|
119
125
  timestamp = entry.realtime_timestamp
120
126
  event = LogStash::Event.new(
121
127
  entry.to_h_lower(@lowercase).merge(
@@ -133,9 +139,7 @@ class LogStash::Inputs::Journald < LogStash::Inputs::Threadable
133
139
  end # def run
134
140
 
135
141
  public
136
- def teardown # FIXME: doesn't really seem to work...
137
- return finished unless @journal # Ignore multiple calls
138
-
142
+ def close # FIXME: doesn't really seem to work...
139
143
  @logger.debug("journald shutting down.")
140
144
  @journal = nil
141
145
  Thread.kill(@sincedb_writer)
@@ -144,9 +148,16 @@ class LogStash::Inputs::Journald < LogStash::Inputs::Threadable
144
148
  file.puts @cursor
145
149
  file.close
146
150
  @cursor = nil
147
- finished
148
- end # def teardown
151
+ end # def close
149
152
 
153
+ private
154
+ def watch_journal
155
+ until stop?
156
+ if @journal.wait(@wait_timeout)
157
+ yield @journal.current_entry while !stop? && @journal.move_next
158
+ end
159
+ end
160
+ end # def watch_journal
150
161
  end # class LogStash::Inputs::Journald
151
162
 
152
163
  # Monkey patch Systemd::JournalEntry
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
 
3
3
  s.name = 'logstash-input-journald'
4
- s.version = '0.0.4'
4
+ s.version = '0.1.0'
5
5
  s.licenses = ['Apache License (2.0)']
6
6
  s.summary = "Read events from local systemd journal"
7
7
  s.description = "This gem is a logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/plugin install gemname. This gem is not a stand-alone program"
@@ -11,7 +11,7 @@ Gem::Specification.new do |s|
11
11
  s.require_paths = ["lib"]
12
12
 
13
13
  # Files
14
- s.files = `git ls-files`.split($\)+::Dir.glob('vendor/*')
14
+ s.files = Dir['lib/**/*','spec/**/*','vendor/**/*','*.gemspec','*.md','Gemfile','LICENSE']
15
15
 
16
16
  # Tests
17
17
  s.test_files = s.files.grep(%r{^(test|spec|features)/})
@@ -20,7 +20,7 @@ Gem::Specification.new do |s|
20
20
  s.metadata = { "logstash_plugin" => "true", "logstash_group" => "input" }
21
21
 
22
22
  # Gem dependencies
23
- s.add_runtime_dependency 'logstash-core', '>= 1.4.0', '< 2.0.0'
23
+ s.add_runtime_dependency 'logstash-core', '>= 2.0.0', '< 3.0.0'
24
24
 
25
25
  s.add_runtime_dependency 'logstash-codec-plain'
26
26
  s.add_runtime_dependency 'logstash-codec-line'
metadata CHANGED
@@ -1,39 +1,39 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-input-journald
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - stuart-warren
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-14 00:00:00.000000000 Z
11
+ date: 2016-03-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
15
15
  requirements:
16
- - - '>='
17
- - !ruby/object:Gem::Version
18
- version: 1.4.0
19
- - - <
16
+ - - ">="
20
17
  - !ruby/object:Gem::Version
21
18
  version: 2.0.0
19
+ - - "<"
20
+ - !ruby/object:Gem::Version
21
+ version: 3.0.0
22
22
  name: logstash-core
23
23
  prerelease: false
24
24
  type: :runtime
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
- - - '>='
28
- - !ruby/object:Gem::Version
29
- version: 1.4.0
30
- - - <
27
+ - - ">="
31
28
  - !ruby/object:Gem::Version
32
29
  version: 2.0.0
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: 3.0.0
33
33
  - !ruby/object:Gem::Dependency
34
34
  requirement: !ruby/object:Gem::Requirement
35
35
  requirements:
36
- - - '>='
36
+ - - ">="
37
37
  - !ruby/object:Gem::Version
38
38
  version: '0'
39
39
  name: logstash-codec-plain
@@ -41,13 +41,13 @@ dependencies:
41
41
  type: :runtime
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
43
  requirements:
44
- - - '>='
44
+ - - ">="
45
45
  - !ruby/object:Gem::Version
46
46
  version: '0'
47
47
  - !ruby/object:Gem::Dependency
48
48
  requirement: !ruby/object:Gem::Requirement
49
49
  requirements:
50
- - - '>='
50
+ - - ">="
51
51
  - !ruby/object:Gem::Version
52
52
  version: '0'
53
53
  name: logstash-codec-line
@@ -55,13 +55,13 @@ dependencies:
55
55
  type: :runtime
56
56
  version_requirements: !ruby/object:Gem::Requirement
57
57
  requirements:
58
- - - '>='
58
+ - - ">="
59
59
  - !ruby/object:Gem::Version
60
60
  version: '0'
61
61
  - !ruby/object:Gem::Dependency
62
62
  requirement: !ruby/object:Gem::Requirement
63
63
  requirements:
64
- - - '>='
64
+ - - ">="
65
65
  - !ruby/object:Gem::Version
66
66
  version: '0'
67
67
  name: logstash-codec-json
@@ -69,13 +69,13 @@ dependencies:
69
69
  type: :runtime
70
70
  version_requirements: !ruby/object:Gem::Requirement
71
71
  requirements:
72
- - - '>='
72
+ - - ">="
73
73
  - !ruby/object:Gem::Version
74
74
  version: '0'
75
75
  - !ruby/object:Gem::Dependency
76
76
  requirement: !ruby/object:Gem::Requirement
77
77
  requirements:
78
- - - '>='
78
+ - - ">="
79
79
  - !ruby/object:Gem::Version
80
80
  version: '0'
81
81
  name: logstash-codec-json_lines
@@ -83,13 +83,13 @@ dependencies:
83
83
  type: :runtime
84
84
  version_requirements: !ruby/object:Gem::Requirement
85
85
  requirements:
86
- - - '>='
86
+ - - ">="
87
87
  - !ruby/object:Gem::Version
88
88
  version: '0'
89
89
  - !ruby/object:Gem::Dependency
90
90
  requirement: !ruby/object:Gem::Requirement
91
91
  requirements:
92
- - - '>='
92
+ - - ">="
93
93
  - !ruby/object:Gem::Version
94
94
  version: '0'
95
95
  name: ffi
@@ -97,13 +97,13 @@ dependencies:
97
97
  type: :runtime
98
98
  version_requirements: !ruby/object:Gem::Requirement
99
99
  requirements:
100
- - - '>='
100
+ - - ">="
101
101
  - !ruby/object:Gem::Version
102
102
  version: '0'
103
103
  - !ruby/object:Gem::Dependency
104
104
  requirement: !ruby/object:Gem::Requirement
105
105
  requirements:
106
- - - ~>
106
+ - - "~>"
107
107
  - !ruby/object:Gem::Version
108
108
  version: 1.2.2
109
109
  name: systemd-journal
@@ -111,13 +111,13 @@ dependencies:
111
111
  type: :runtime
112
112
  version_requirements: !ruby/object:Gem::Requirement
113
113
  requirements:
114
- - - ~>
114
+ - - "~>"
115
115
  - !ruby/object:Gem::Version
116
116
  version: 1.2.2
117
117
  - !ruby/object:Gem::Dependency
118
118
  requirement: !ruby/object:Gem::Requirement
119
119
  requirements:
120
- - - '>='
120
+ - - ">="
121
121
  - !ruby/object:Gem::Version
122
122
  version: '0'
123
123
  name: logstash-devutils
@@ -125,7 +125,7 @@ dependencies:
125
125
  type: :development
126
126
  version_requirements: !ruby/object:Gem::Requirement
127
127
  requirements:
128
- - - '>='
128
+ - - ">="
129
129
  - !ruby/object:Gem::Version
130
130
  version: '0'
131
131
  description: This gem is a logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/plugin install gemname. This gem is not a stand-alone program
@@ -134,11 +134,9 @@ executables: []
134
134
  extensions: []
135
135
  extra_rdoc_files: []
136
136
  files:
137
- - .gitignore
138
137
  - Gemfile
139
138
  - LICENSE
140
139
  - README.md
141
- - Rakefile
142
140
  - lib/logstash/inputs/journald.rb
143
141
  - logstash-input-journald.gemspec
144
142
  - spec/inputs/journald_spec.rb
@@ -154,12 +152,12 @@ require_paths:
154
152
  - lib
155
153
  required_ruby_version: !ruby/object:Gem::Requirement
156
154
  requirements:
157
- - - '>='
155
+ - - ">="
158
156
  - !ruby/object:Gem::Version
159
157
  version: '0'
160
158
  required_rubygems_version: !ruby/object:Gem::Requirement
161
159
  requirements:
162
- - - '>='
160
+ - - ">="
163
161
  - !ruby/object:Gem::Version
164
162
  version: '0'
165
163
  requirements: []
data/.gitignore DELETED
@@ -1,4 +0,0 @@
1
- *.gem
2
- Gemfile.lock
3
- .bundle
4
- vendor
data/Rakefile DELETED
@@ -1,7 +0,0 @@
1
- @files=[]
2
-
3
- task :default do
4
- system("rake -T")
5
- end
6
-
7
- require "logstash/devutils/rake"