logstash-input-cloudflare_logs 0.1.2 → 0.1.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: 1a7139959102c50bbe70f6f32d2dcb94efc2e96b
|
4
|
+
data.tar.gz: 587e5c2f61b9292e99ed759bc31b0e59e492a245
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9a53497bf46c9536423aa72447daa280cffd7228f03afed4adaf78f94b067bc5c412f087846efc51391071b7ebf06b0fa1a4112070bea2c3a349c3fa87a8d2c
|
7
|
+
data.tar.gz: 531685c8afc186276dbd889705ceb2f489448a76bd39baa41ad02d870c8d912410312a93ab03463136dcc81c6fbdab9da9c08318a5186075357af25223eb6fe6
|
@@ -21,7 +21,11 @@ class CloudflareAccess
|
|
21
21
|
|
22
22
|
def start_time
|
23
23
|
if File.exist?(metadata_file)
|
24
|
-
|
24
|
+
begin
|
25
|
+
start_time = Time.parse(JSON.parse(File.read(metadata_file))['start_time']).to_datetime.rfc3339
|
26
|
+
rescue JSON::ParserError
|
27
|
+
start_time = (Time.now - (15 * 60)).to_datetime.rfc3339
|
28
|
+
end
|
25
29
|
else
|
26
30
|
start_time = (Time.now - (15 * 60)).to_datetime.rfc3339
|
27
31
|
end
|
@@ -39,7 +43,7 @@ class CloudflareAccess
|
|
39
43
|
if File.exist?(metadata_file)
|
40
44
|
begin
|
41
45
|
meta_data = JSON.parse(File.read(metadata_file))
|
42
|
-
rescue
|
46
|
+
rescue JSON::ParserError
|
43
47
|
end
|
44
48
|
end
|
45
49
|
|
@@ -21,6 +21,15 @@ describe CloudflareAccess do
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
+
it 'should return the default time meta file is there but is empty' do
|
25
|
+
`rm #{meta_filename}`
|
26
|
+
`touch #{meta_filename}`
|
27
|
+
|
28
|
+
Timecop.freeze do
|
29
|
+
expect(subject).to eq((Time.now - (15 * 60)).to_datetime.rfc3339)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
24
33
|
it 'should return the start time in the file if it is correct' do
|
25
34
|
Timecop.freeze do
|
26
35
|
File.open(meta_filename, 'w+') { |file| file.write({ start_time: Time.now - (24 * 60 * 60) }.to_json) }
|
data/spec/tmp/metadata.json
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"start_time":"2017-10-
|
1
|
+
{"start_time":"2017-10-19 14:21:06 -0400"}
|