fluent-plugin-elasticsearch-timestamp-check 0.2.1 → 0.2.3
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3a0af9963774d5d11e0fd569c18017ba307572c0
|
4
|
+
data.tar.gz: 29a7a6840726c287338520259c7c558647426d7f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e56942ca9ca13036e4d07b7256daa46cd7de5d8e2b55462adb46ef87eea6374cf74c72a2669a6f48eff7d7e7e1d28bd6c6248091835f115aaaf877075b8eafa4
|
7
|
+
data.tar.gz: adae81c6a571fc8803c81294da883eb9517b06abaa9a174d5cf6742a754d41b758b72a2eb8b2c923217f8a92cb7134ad8a59a2acfd1a3faa5ea015ab069fbaf5
|
data/README.md
CHANGED
@@ -16,10 +16,11 @@ elasticsearch.
|
|
16
16
|
* If *@timestamp* field already exists, it will ensure the format is correct
|
17
17
|
by parse and convert to format '%Y-%m-%dT%H:%M:%S%z'.
|
18
18
|
|
19
|
-
* If a field named *timestamp*
|
20
|
-
format '%Y-%m-%dT%H:%M:%S%z' then store it
|
19
|
+
* If a field named *timestamp* or *time* or *syslog_timestamp* exists, it will
|
20
|
+
parse that field and conver it to format '%Y-%m-%dT%H:%M:%S%z' then store it
|
21
|
+
in *@timestamp* field.
|
21
22
|
|
22
|
-
* If
|
23
|
+
* If none of the above field exists, it will insert current time in
|
23
24
|
'%Y-%m-%dT%H:%M:%S%z' format as the *@timestamp* field.
|
24
25
|
|
25
26
|
## Usage
|
@@ -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
|
+
spec.version = "0.2.3"
|
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}
|
@@ -18,32 +18,24 @@ module Fluent::Plugin
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def filter(tag, time, record)
|
21
|
-
|
22
|
-
|
23
|
-
|
21
|
+
%w{@timestamp timestamp time syslog_timestamp}.map do |field|
|
22
|
+
record[field]
|
23
|
+
end.compact.each do |timestamp|
|
24
24
|
begin
|
25
|
-
|
26
|
-
DateTime.parse(timestamp)
|
27
|
-
|
28
|
-
|
29
|
-
end
|
25
|
+
record['@timestamp'] = record['fluent_converted_timestamp'] =
|
26
|
+
DateTime.parse(timestamp).strftime('%Y-%m-%dT%H:%M:%S.%L%z')
|
27
|
+
$log.debug("Timestamp parsed: #{record['@timestamp']}")
|
28
|
+
break
|
30
29
|
rescue ArgumentError
|
31
|
-
next
|
32
30
|
end
|
33
31
|
end
|
34
32
|
|
35
|
-
|
36
|
-
record['@timestamp'] =
|
37
|
-
DateTime.parse(valid).strftime('%Y-%m-%dT%H:%M:%S.%L%z')
|
38
|
-
record['fluent_converted_timestamp'] =
|
39
|
-
DateTime.parse(valid).strftime('%Y-%m-%dT%H:%M:%S.%L%z')
|
40
|
-
$log.debug("Timestamp parsed: #{record['@timestamp']}")
|
41
|
-
else
|
42
|
-
record['@timestamp'] = Time.now.strftime('%Y-%m-%dT%H:%M:%S.%L%z')
|
43
|
-
record['fluent_added_timestamp'] =
|
33
|
+
unless record['fluent_converted_timestamp']
|
34
|
+
record['@timestamp'] = record['fluent_added_timestamp'] =
|
44
35
|
Time.now.strftime('%Y-%m-%dT%H:%M:%S.%L%z')
|
45
36
|
$log.debug("Timestamp added: #{record['@timestamp']}")
|
46
37
|
end
|
38
|
+
|
47
39
|
record
|
48
40
|
end
|
49
41
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Li
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-06-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|