fluent-plugin-time-cutoff 0.1.2 → 0.1.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 +4 -4
- data/fluent-plugin-time-cutoff.gemspec +1 -1
- data/lib/fluent/plugin/filter_time_cutoff.rb +19 -0
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3ced312074114226376fedaf33671d11804667825d8a50430c1ac54137aac535
|
|
4
|
+
data.tar.gz: c11dc8c0510a8adec9475bac1382a003255bdb8e3af7de6f8aba46defa60ff16
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: dd2ea5a6907c0b27e95580c0081030de242dcd3cb85ef4bbd79a99918c369ee53680187a866c78e12016ae47d1d534c2b4461a5b6bd522e3f0b2ef691a3c1fb2
|
|
7
|
+
data.tar.gz: 6d39a4673c35dac85aff1e96d4575e87c03f807973acdaa86dca01b6e729f587fbeeec8939a4683e7491ebf0d5cef86fbb0e38f65b70aa90d259db5347188b98
|
|
@@ -5,7 +5,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
|
5
5
|
|
|
6
6
|
Gem::Specification.new do |spec|
|
|
7
7
|
spec.name = 'fluent-plugin-time-cutoff'
|
|
8
|
-
spec.version = '0.1.
|
|
8
|
+
spec.version = '0.1.3'
|
|
9
9
|
spec.authors = ['Qrator Labs', 'Serge Tkatchouk']
|
|
10
10
|
spec.email = ['devops@qrator.net', 'st@qrator.net']
|
|
11
11
|
|
|
@@ -115,6 +115,22 @@ module Fluent
|
|
|
115
115
|
log.warn log_line
|
|
116
116
|
end
|
|
117
117
|
|
|
118
|
+
# Normalize time to Fluent::EventTime if it's plain int or float.
|
|
119
|
+
# @param time [Integer|Float] incoming event time
|
|
120
|
+
# @return [Fluent::EventTime] event time normalized to Fluentd's internal format
|
|
121
|
+
def normalize_time(time)
|
|
122
|
+
case time.class
|
|
123
|
+
when Integer
|
|
124
|
+
Fluent::EventTime.new(time)
|
|
125
|
+
when Float
|
|
126
|
+
time_int, time_frac = time.divmod(1)
|
|
127
|
+
Fluent::EventTime.new(time_int, (time_frac * 10**9).to_i)
|
|
128
|
+
else
|
|
129
|
+
log.warn "Unknown time format given: \"#{time.inspect}\"."
|
|
130
|
+
Fluent::EventTime.new(time.to_i) || Fluent::EventTime.now
|
|
131
|
+
end
|
|
132
|
+
end
|
|
133
|
+
|
|
118
134
|
# Process the record according to its determined "age"
|
|
119
135
|
# @param tag [String] log/stream's tag name
|
|
120
136
|
# @param time [Fluent::EventTime] the original event time
|
|
@@ -123,6 +139,9 @@ module Fluent
|
|
|
123
139
|
# @param action [Symbol] determined action for this record
|
|
124
140
|
# @param age [Symbol] detemined age for this record (:old or :new)
|
|
125
141
|
def process_record(tag, time, record, do_log, action, age) # rubocop:disable Metrics/ParameterLists
|
|
142
|
+
## Safeguard against rogue integer time.
|
|
143
|
+
time = normalize_time(time) unless time.is_a?(Fluent::EventTime)
|
|
144
|
+
|
|
126
145
|
log_record(tag, time, record, action, age) if do_log
|
|
127
146
|
|
|
128
147
|
case action
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: fluent-plugin-time-cutoff
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Qrator Labs
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2025-
|
|
12
|
+
date: 2025-11-24 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: fluentd
|
|
@@ -107,7 +107,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
107
107
|
- !ruby/object:Gem::Version
|
|
108
108
|
version: '0'
|
|
109
109
|
requirements: []
|
|
110
|
-
rubygems_version: 3.
|
|
110
|
+
rubygems_version: 3.3.27
|
|
111
111
|
signing_key:
|
|
112
112
|
specification_version: 4
|
|
113
113
|
summary: Fluentd time-based filter plugin.
|