fluent-plugin-utmpx 0.4.0 → 0.5.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 90c5cc2703544154608ba4f78eb2073bfee3d22a2e4da53111e4ffea144bb29a
4
- data.tar.gz: 46e1a239c01c29ec0aa3043031b859c0968e8cc451aa32a2fc6e2a4c41d81256
3
+ metadata.gz: 68d3cabe9c9f7865bfb0770959d26e8cca09addf1a8aa5ed33aa1aeda354bc69
4
+ data.tar.gz: 89b374d79e6c0d296b8dcfc2fe847e19f5354e407a4a36d18449e706f86d08ae
5
5
  SHA512:
6
- metadata.gz: 209da14c9f6bbe3f52f273bd33dfd5ad57e1bb2dced1e5d933415ec3c11cf3b651d4c90b201d7925016fc3ad487ae7167fd786686b04c3469ea72513b84370b3
7
- data.tar.gz: 9da5a80b44b57c6568b55d2e7fb8601d4474910f4b7c5996ec2cdc32103e3bab29b98d2a85712d7924c3694d81fc90d8a22e35ab5d095c0d829a7d20670f0705
6
+ metadata.gz: d518632c6959910dccb11129beae4b19434920ff407d98606a066cd66555b5836e429f7b8fa4e7e3b94c1cb9a974869093a65a5832b6ad5a90ae7cecb6de0b43
7
+ data.tar.gz: 0f95670e7e8649b0a1b504a08d92a8f54da3e3f1365764c4c39c99a1eb3a026df569d0b48b2b76ba3a54ce1b94cd190bd5182f2a7c9b06c1e436da70c21d03fa
@@ -9,7 +9,8 @@ jobs:
9
9
  fail-fast: false
10
10
  matrix:
11
11
  ruby: [ '2.5', '2.6', '2.7', '3.0' ]
12
- name: Ruby ${{ matrix.ruby }} unit testing on ubuntu-latest
12
+ fluentd: ['1.11.5', '1.12.2']
13
+ name: Ruby ${{ matrix.ruby }} Fluentd ${{ matrix.fluentd }}
13
14
  steps:
14
15
  - uses: actions/checkout@v2
15
16
  - name: Set up Ruby
@@ -18,6 +19,9 @@ jobs:
18
19
  ruby-version: ${{ matrix.ruby }}
19
20
  - name: Run the default task
20
21
  run: |
21
- gem install bundler
22
- bundle install
22
+ gem install fluentd -v ${{ matrix.fluentd }}
23
+ gem install rake -v 12.0
24
+ gem install webrick
25
+ rake build
26
+ gem install ./pkg/fluent-plugin-utmpx*.gem
23
27
  TESTOPTS="--verbose" bundle exec rake
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 0.5.0 (2021-04-02)
4
+
5
+ * Changed to keep compatibility with Fluentd 1.11 [GitHub#3] [GitHub#4]
6
+
3
7
  ## 0.4.0 (2021-03-31)
4
8
 
5
9
  * Update to latest linux-utmpx 0.3.0
@@ -3,12 +3,12 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
3
 
4
4
  Gem::Specification.new do |spec|
5
5
  spec.name = "fluent-plugin-utmpx"
6
- spec.version = "0.4.0"
6
+ spec.version = "0.5.0"
7
7
  spec.authors = ["Kentaro Hayashi"]
8
8
  spec.email = ["kenhys@gmail.com"]
9
9
 
10
- spec.summary = %q{Fluentd Parser plugin to parse login records}
11
- spec.description = %q{Fluentd Parser plugin to parse /var/log/wtmp,/var/run/utmp}
10
+ spec.summary = %q{Fluentd Input plugin to parse login records}
11
+ spec.description = %q{Fluentd Input plugin to parse /var/log/wtmp,/var/run/utmp}
12
12
  spec.homepage = "https://github.com/fluent-plugins-nursery/fluent-plugin-utmpx"
13
13
  spec.license = "Apache-2.0"
14
14
 
@@ -13,6 +13,7 @@
13
13
  # See the License for the specific language governing permissions and
14
14
  # limitations under the License.
15
15
 
16
+ require "fluent/version"
16
17
  require "fluent/plugin/input"
17
18
  require "fluent/plugin/in_tail/position_file"
18
19
  require 'fluent/variable_store'
@@ -22,6 +23,9 @@ Fluent::FileWrapper = File
22
23
 
23
24
  module Fluent
24
25
  module Plugin
26
+
27
+ TargetInfo = Struct.new(:path, :ino)
28
+
25
29
  class UtmpxInput < Fluent::Plugin::Input
26
30
  Fluent::Plugin.register_input("utmpx", self)
27
31
 
@@ -58,15 +62,23 @@ module Fluent
58
62
  FileUtils.mkdir_p(pos_file_dir, mode: Fluent::DEFAULT_DIR_PERMISSION) unless Dir.exist?(pos_file_dir)
59
63
  @pf_file = File.open(@pos_file, File::RDWR|File::CREAT|File::BINARY, Fluent::DEFAULT_FILE_PERMISSION)
60
64
  @pf_file.sync = true
61
- target_info = TailInput::TargetInfo.new(@path, Fluent::FileWrapper.stat(@path).ino)
62
- @pf = TailInput::PositionFile.load(@pf_file, false, {target_info.path => target_info}, logger: log)
65
+ target_info = TargetInfo.new(@path, Fluent::FileWrapper.stat(@path).ino)
66
+ if Gem::Version.new(Fluent::VERSION) < Gem::Version.new("1.12.0")
67
+ @pf = TailInput::PositionFile.load(@pf_file, logger: log)
68
+ else
69
+ @pf = TailInput::PositionFile.load(@pf_file, false, {target_info.path => target_info}, logger: log)
70
+ end
63
71
 
64
72
  timer_execute(:execute_utmpx, @interval, &method(:refresh_watchers))
65
73
  end
66
74
 
67
75
  def refresh_watchers
68
76
  @tail_position = Fluent::FileWrapper.stat(@path).size
69
- @pe = @pf[TailInput::TargetInfo.new(@path, Fluent::FileWrapper.stat(@path).ino)]
77
+ if Gem::Version.new(Fluent::VERSION) < Gem::Version.new("1.12.0")
78
+ @pe = @pf[@path]
79
+ else
80
+ @pe = @pf[TargetInfo.new(@path, Fluent::FileWrapper.stat(@path).ino)]
81
+ end
70
82
  return if (@tail_position - @pe.read_pos) == 0
71
83
 
72
84
  if (@tail_position - @pe.read_pos) < 0
@@ -85,9 +85,14 @@ class UtmpxInputTest < Test::Unit::TestCase
85
85
  create_wtmp
86
86
  @tail_position = Fluent::FileWrapper.stat(wtmp_path).size
87
87
  File.open(utmpx_pos_path, "w+") do |file|
88
- target_info = Fluent::Plugin::TailInput::TargetInfo.new(wtmp_path, Fluent::FileWrapper.stat(wtmp_path).ino)
89
- @pf = Fluent::Plugin::TailInput::PositionFile.new(file, false, {wtmp_path => target_info}, logger: nil)
90
- @pe = @pf[target_info]
88
+ target_info = Fluent::Plugin::TargetInfo.new(wtmp_path, Fluent::FileWrapper.stat(wtmp_path).ino)
89
+ if Gem::Version.new(Fluent::VERSION) < Gem::Version.new("1.12.0")
90
+ @pf = Fluent::Plugin::TailInput::PositionFile.new(file, logger: nil)
91
+ @pe = @pf[wtmp_path]
92
+ else
93
+ @pf = Fluent::Plugin::TailInput::PositionFile.new(file, false, {wtmp_path => target_info}, logger: nil)
94
+ @pe = @pf[target_info]
95
+ end
91
96
  @pe.update_pos(@tail_position)
92
97
  end
93
98
  d = create_driver(utmpx_config(wtmp_path))
@@ -104,9 +109,14 @@ class UtmpxInputTest < Test::Unit::TestCase
104
109
  end
105
110
  @tail_position = Fluent::FileWrapper.stat(wtmp_path).size
106
111
  File.open(utmpx_pos_path, "w+") do |file|
107
- target_info = Fluent::Plugin::TailInput::TargetInfo.new(wtmp_path, Fluent::FileWrapper.stat(wtmp_path).ino)
108
- @pf = Fluent::Plugin::TailInput::PositionFile.new(file, false, {wtmp_path => target_info}, logger: nil)
109
- @pe = @pf[target_info]
112
+ target_info = Fluent::Plugin::TargetInfo.new(wtmp_path, Fluent::FileWrapper.stat(wtmp_path).ino)
113
+ if Gem::Version.new(Fluent::VERSION) < Gem::Version.new("1.12.0")
114
+ @pf = Fluent::Plugin::TailInput::PositionFile.new(file, logger: nil)
115
+ @pe = @pf[wtmp_path]
116
+ else
117
+ @pf = Fluent::Plugin::TailInput::PositionFile.new(file, false, {wtmp_path => target_info}, logger: nil)
118
+ @pe = @pf[target_info]
119
+ end
110
120
  @pe.update_pos(@tail_position)
111
121
  end
112
122
  File.open(wtmp_path, "w+") do |file|
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-utmpx
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kentaro Hayashi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-31 00:00:00.000000000 Z
11
+ date: 2021-04-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: linux-utmpx
@@ -100,7 +100,7 @@ dependencies:
100
100
  - - ">="
101
101
  - !ruby/object:Gem::Version
102
102
  version: '0'
103
- description: Fluentd Parser plugin to parse /var/log/wtmp,/var/run/utmp
103
+ description: Fluentd Input plugin to parse /var/log/wtmp,/var/run/utmp
104
104
  email:
105
105
  - kenhys@gmail.com
106
106
  executables: []
@@ -146,7 +146,7 @@ requirements: []
146
146
  rubygems_version: 3.1.4
147
147
  signing_key:
148
148
  specification_version: 4
149
- summary: Fluentd Parser plugin to parse login records
149
+ summary: Fluentd Input plugin to parse login records
150
150
  test_files:
151
151
  - test/fixtures/Makefile
152
152
  - test/fixtures/alice_login.dump