systemd-journal 1.3.3 → 1.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/README.md +12 -11
- data/certs/john@throttle.io.pem +16 -16
- data/lib/systemd/journal.rb +10 -2
- data/lib/systemd/journal/version.rb +1 -1
- data/spec/systemd/journal_spec.rb +18 -0
- metadata +19 -19
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 7954a07279ccaf744edb91b9d0ddf2dacd24cb66
|
4
|
+
data.tar.gz: c8ef65bcdd2d50edc7a48c45370120b34eb2025b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 39ad407354a6850dca2ce66b4e6a5073468fbd7d4124e99dcc4e1777629783c50a190855714aeed313920ffdd84dc65fc164a11a869e2fe56009809671b467bc
|
7
|
+
data.tar.gz: f1b2f96ba311b770772e88f8692f35746d0f7d615e723bd2f484237696abd2946162e40ef07841bae731492780b645161cb4e6d9042454984d185ff5b8528abe
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/README.md
CHANGED
@@ -49,13 +49,14 @@ require 'systemd/journal'
|
|
49
49
|
Print all messages as they occur:
|
50
50
|
|
51
51
|
```ruby
|
52
|
-
|
53
|
-
j.seek(:tail)
|
54
|
-
j.move_previous
|
55
|
-
|
56
|
-
# watch() does not return
|
57
|
-
j.watch do |entry|
|
58
|
-
|
52
|
+
Systemd::Journal.open do |j|
|
53
|
+
j.seek(:tail)
|
54
|
+
j.move_previous
|
55
|
+
|
56
|
+
# watch() does not return
|
57
|
+
j.watch do |entry|
|
58
|
+
puts entry.message
|
59
|
+
end
|
59
60
|
end
|
60
61
|
```
|
61
62
|
|
@@ -69,6 +70,7 @@ j.filter(priority: 6, _exe: '/usr/bin/sshd')
|
|
69
70
|
j.each do |entry|
|
70
71
|
puts entry.message
|
71
72
|
end
|
73
|
+
j.close # close open files
|
72
74
|
```
|
73
75
|
|
74
76
|
Moving around the journal:
|
@@ -99,11 +101,10 @@ j = Systemd::Journal.new
|
|
99
101
|
j.seek(:tail)
|
100
102
|
j.move_previous
|
101
103
|
# wait up to one second for something to happen
|
102
|
-
if j.wait(1_000_000)
|
103
|
-
|
104
|
+
puts 'something changed!' if j.wait(1_000_000)
|
105
|
+
|
104
106
|
# same as above, but can be interrupted with Control+C.
|
105
|
-
if j.wait(1_000_000, select: true)
|
106
|
-
puts 'something changed!'
|
107
|
+
puts 'something changed!' if j.wait(1_000_000, select: true)
|
107
108
|
```
|
108
109
|
|
109
110
|
Accessing the catalog:
|
data/certs/john@throttle.io.pem
CHANGED
@@ -1,21 +1,21 @@
|
|
1
1
|
-----BEGIN CERTIFICATE-----
|
2
2
|
MIIDaDCCAlCgAwIBAgIBATANBgkqhkiG9w0BAQUFADA9MQ0wCwYDVQQDDARqb2hu
|
3
3
|
MRgwFgYKCZImiZPyLGQBGRYIdGhyb3R0bGUxEjAQBgoJkiaJk/IsZAEZFgJpbzAe
|
4
|
-
|
4
|
+
Fw0xOTAzMDUyMDM1MjZaFw0yMDAzMDQyMDM1MjZaMD0xDTALBgNVBAMMBGpvaG4x
|
5
5
|
GDAWBgoJkiaJk/IsZAEZFgh0aHJvdHRsZTESMBAGCgmSJomT8ixkARkWAmlvMIIB
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
6
|
+
IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtt7tfjZWDXScvPrmsfgFTAk4
|
7
|
+
q8hSkI5B4R+IsIquG6M9cNhbbQJyofRQxfzY0lGWC8Xtd+bRt04WVznerSNqbPFP
|
8
|
+
Gou2NHQvI77T/UDvjYvbf+7ZVYHgWHzIjoFAHeUDV0hAMPIizoX04nDsPSqiKHxp
|
9
|
+
6fypG8eLdiMn+Ab8/M+94FeXL/EhSQcvOFE0P98SgYu57jhPfbdH4IeN+eIoO8e7
|
10
|
+
yjbi6jbtVa2k9ZDi4mlg0f8cH8nYXfO9wKDW3lcPa4Le4MwIAy70iEozoxdDQd+X
|
11
|
+
5X2ZYk2Mcss+FxhzZro/ChJgdGWk0gM632koFaIuCRgmtp2a915WXhMrsYyrsQID
|
12
|
+
AQABo3MwcTAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQUnFpnqd56
|
13
|
+
KP6ORCFp9LEvackdywQwGwYDVR0RBBQwEoEQam9obkB0aHJvdHRsZS5pbzAbBgNV
|
14
|
+
HRIEFDASgRBqb2huQHRocm90dGxlLmlvMA0GCSqGSIb3DQEBBQUAA4IBAQCNvyn1
|
15
|
+
8hDTha8YvQtrJd5OTNoMztU3k+1zsv4KzAkvqcp1TpJfTF54GLq4QXcUYaepxCTW
|
16
|
+
PUBdWX8cgjZePmJ005KT3MPtA//o1nATLyYWc86Xk02FI9f7h4K6lSHMUr/L2fVL
|
17
|
+
9DahKJje3A0xvOupPKojNqHRB8NPwOV7lbD9Na8vqymCxqahh6VYGreAHAmoFJLw
|
18
|
+
Hw1jejkkg22p795C8ajT+BVGkALv64eUKBcg43XRiEdURHk6N0a9hPeV+F0pXJSi
|
19
|
+
qFmZlFSs2UEGpMrcVelMgdQ5dBFzZ/SIvfYO70bQhRRae39Z/QmV0jEgYx5f2Q1d
|
20
|
+
bc0+je0pm4TYY6oC
|
21
21
|
-----END CERTIFICATE-----
|
data/lib/systemd/journal.rb
CHANGED
@@ -48,12 +48,20 @@ module Systemd
|
|
48
48
|
open_type, flags = validate_options!(opts)
|
49
49
|
ptr = FFI::MemoryPointer.new(:pointer, 1)
|
50
50
|
|
51
|
+
@finalize = (opts.key?(:finalize) ? opts.delete(:finalize) : true)
|
51
52
|
rc = open_journal(open_type, ptr, opts, flags)
|
52
53
|
raise JournalError, rc if rc < 0
|
53
54
|
|
54
55
|
@ptr = ptr.read_pointer
|
55
56
|
file_descriptor
|
56
|
-
ObjectSpace.define_finalizer(self, self.class.finalize(@ptr))
|
57
|
+
ObjectSpace.define_finalizer(self, self.class.finalize(@ptr)) if @finalize
|
58
|
+
end
|
59
|
+
|
60
|
+
def self.open(opts = {})
|
61
|
+
j = new(opts.merge(finalize: false))
|
62
|
+
yield j
|
63
|
+
ensure
|
64
|
+
j.close if j
|
57
65
|
end
|
58
66
|
|
59
67
|
# Iterate over each entry in the journal, respecting the applied
|
@@ -198,7 +206,7 @@ module Systemd
|
|
198
206
|
def close
|
199
207
|
return if @ptr.nil?
|
200
208
|
|
201
|
-
ObjectSpace.undefine_finalizer(self)
|
209
|
+
ObjectSpace.undefine_finalizer(self) if @finalize
|
202
210
|
Native.sd_journal_close(@ptr)
|
203
211
|
|
204
212
|
@ptr = nil
|
@@ -8,6 +8,24 @@ RSpec.describe Systemd::Journal do
|
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
|
+
describe 'open' do
|
12
|
+
it 'creates and closes' do
|
13
|
+
expect(Systemd::Journal::Native).to receive(:sd_journal_close)
|
14
|
+
.and_call_original
|
15
|
+
|
16
|
+
result = j.open { 1 }
|
17
|
+
expect(result).to eq 1
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'raises original exception when creating journal fails' do
|
21
|
+
expect(Systemd::Journal::Native).to_not receive(:sd_journal_close)
|
22
|
+
|
23
|
+
expect do
|
24
|
+
j.open(file: 1, path: 2, files: 3) { 1 }
|
25
|
+
end.to raise_error(ArgumentError)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
11
29
|
describe 'initialize' do
|
12
30
|
subject(:j) { Systemd::Journal }
|
13
31
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: systemd-journal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Ledbetter
|
@@ -13,25 +13,25 @@ cert_chain:
|
|
13
13
|
-----BEGIN CERTIFICATE-----
|
14
14
|
MIIDaDCCAlCgAwIBAgIBATANBgkqhkiG9w0BAQUFADA9MQ0wCwYDVQQDDARqb2hu
|
15
15
|
MRgwFgYKCZImiZPyLGQBGRYIdGhyb3R0bGUxEjAQBgoJkiaJk/IsZAEZFgJpbzAe
|
16
|
-
|
16
|
+
Fw0xOTAzMDUyMDM1MjZaFw0yMDAzMDQyMDM1MjZaMD0xDTALBgNVBAMMBGpvaG4x
|
17
17
|
GDAWBgoJkiaJk/IsZAEZFgh0aHJvdHRsZTESMBAGCgmSJomT8ixkARkWAmlvMIIB
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
18
|
+
IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtt7tfjZWDXScvPrmsfgFTAk4
|
19
|
+
q8hSkI5B4R+IsIquG6M9cNhbbQJyofRQxfzY0lGWC8Xtd+bRt04WVznerSNqbPFP
|
20
|
+
Gou2NHQvI77T/UDvjYvbf+7ZVYHgWHzIjoFAHeUDV0hAMPIizoX04nDsPSqiKHxp
|
21
|
+
6fypG8eLdiMn+Ab8/M+94FeXL/EhSQcvOFE0P98SgYu57jhPfbdH4IeN+eIoO8e7
|
22
|
+
yjbi6jbtVa2k9ZDi4mlg0f8cH8nYXfO9wKDW3lcPa4Le4MwIAy70iEozoxdDQd+X
|
23
|
+
5X2ZYk2Mcss+FxhzZro/ChJgdGWk0gM632koFaIuCRgmtp2a915WXhMrsYyrsQID
|
24
|
+
AQABo3MwcTAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQUnFpnqd56
|
25
|
+
KP6ORCFp9LEvackdywQwGwYDVR0RBBQwEoEQam9obkB0aHJvdHRsZS5pbzAbBgNV
|
26
|
+
HRIEFDASgRBqb2huQHRocm90dGxlLmlvMA0GCSqGSIb3DQEBBQUAA4IBAQCNvyn1
|
27
|
+
8hDTha8YvQtrJd5OTNoMztU3k+1zsv4KzAkvqcp1TpJfTF54GLq4QXcUYaepxCTW
|
28
|
+
PUBdWX8cgjZePmJ005KT3MPtA//o1nATLyYWc86Xk02FI9f7h4K6lSHMUr/L2fVL
|
29
|
+
9DahKJje3A0xvOupPKojNqHRB8NPwOV7lbD9Na8vqymCxqahh6VYGreAHAmoFJLw
|
30
|
+
Hw1jejkkg22p795C8ajT+BVGkALv64eUKBcg43XRiEdURHk6N0a9hPeV+F0pXJSi
|
31
|
+
qFmZlFSs2UEGpMrcVelMgdQ5dBFzZ/SIvfYO70bQhRRae39Z/QmV0jEgYx5f2Q1d
|
32
|
+
bc0+je0pm4TYY6oC
|
33
33
|
-----END CERTIFICATE-----
|
34
|
-
date:
|
34
|
+
date: 2019-03-25 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: ffi
|
@@ -195,7 +195,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
195
195
|
version: '0'
|
196
196
|
requirements: []
|
197
197
|
rubyforge_project:
|
198
|
-
rubygems_version: 2.
|
198
|
+
rubygems_version: 2.6.14.1
|
199
199
|
signing_key:
|
200
200
|
specification_version: 4
|
201
201
|
summary: Ruby bindings to libsystemd-journal
|
metadata.gz.sig
CHANGED
Binary file
|