fluent-plugin-elasticsearch-timestamp-check 0.2.3 → 0.2.4

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
  SHA1:
3
- metadata.gz: 3a0af9963774d5d11e0fd569c18017ba307572c0
4
- data.tar.gz: 29a7a6840726c287338520259c7c558647426d7f
3
+ metadata.gz: caf11889f096c3937908340a59ff69af610e80a9
4
+ data.tar.gz: 5fec5fb248ae90cae895942b8d1fb6544e5a233c
5
5
  SHA512:
6
- metadata.gz: e56942ca9ca13036e4d07b7256daa46cd7de5d8e2b55462adb46ef87eea6374cf74c72a2669a6f48eff7d7e7e1d28bd6c6248091835f115aaaf877075b8eafa4
7
- data.tar.gz: adae81c6a571fc8803c81294da883eb9517b06abaa9a174d5cf6742a754d41b758b72a2eb8b2c923217f8a92cb7134ad8a59a2acfd1a3faa5ea015ab069fbaf5
6
+ metadata.gz: 4904d97b3143926d00c313bef06a1e3e2f79413f6c867ca2e3cde2bbbf6db46b68960bab98abd0e28c702e849377bd15b5ee2c56a0c5640ece68f77204138c6d
7
+ data.tar.gz: 3d3e8575835bdb4a9d9e28e70c9abbb7a58ea8cee7a6fc0e97dff92b3ecfb09afd728c928a47b3dbd115d54a5661e1a821ec55ef9c603169a3d2dae7d30bae76
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "fluent-plugin-elasticsearch-timestamp-check"
3
- spec.version = "0.2.3"
3
+ spec.version = "0.2.4"
4
4
  spec.authors = ["Richard Li"]
5
5
  spec.email = ["evilcat@wisewolfsolutions.com"]
6
6
  spec.description = %q{fluent filter plugin to ensure @timestamp is in proper format}
@@ -22,6 +22,21 @@ module Fluent::Plugin
22
22
  record[field]
23
23
  end.compact.each do |timestamp|
24
24
  begin
25
+ # all digit entry would be treated as epoch seconds or epoch millis
26
+ if !!(timestamp =~ /\A[-+]?\d+\z/)
27
+ num = timestamp.to_i
28
+ # epoch second or epoch millis should be either 10 or 13 digits
29
+ # other length should be considered invalid (until the next digit
30
+ # rollover at 2286-11-20 17:46:40 Z
31
+ next unless [10, 13].include?(num.to_s.length)
32
+ record['@timestamp'] = record['fluent_converted_timestamp'] =
33
+ Time.at(
34
+ num / (10 ** (num.to_s.length - 10))
35
+ ).strftime('%Y-%m-%dT%H:%M:%S.%L%z')
36
+ break
37
+ end
38
+
39
+ # normal timestamp string processing
25
40
  record['@timestamp'] = record['fluent_converted_timestamp'] =
26
41
  DateTime.parse(timestamp).strftime('%Y-%m-%dT%H:%M:%S.%L%z')
27
42
  $log.debug("Timestamp parsed: #{record['@timestamp']}")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-elasticsearch-timestamp-check
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Li