logstash-input-cloudflare 0.9.2 → 0.9.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: 085cf38020417111f4172fe95693004884b01246
4
- data.tar.gz: 3425837336a0f57199abcc04f9c4eb960277d867
3
+ metadata.gz: 7c255265d2e8dab0a73b53ac9f63b8ff0e220e65
4
+ data.tar.gz: 5325e7cdfea4207b7e7ef030fd68c2c10f02a6ca
5
5
  SHA512:
6
- metadata.gz: f094121047dd883418352a333ad2fc45dcf1e23a17bfd7bb2f888bffa1affe4b12b018798d03bd373ff3df1de87b6ea763aaf3f456c0410b46f0613de5f2fba7
7
- data.tar.gz: 02388bd90d140c45298c30b26e640e201d95865fdf72cb8c0cddc0e7caafd71a7617fd4b42b77a82efed035feca1d5741f1b078b042f8cc81cf4d31ad908e484
6
+ metadata.gz: 2c879cae30e927317d5960027fb5b931a040690ba9ca0b544bbc3aab0b696b6822a997eedf2bf9dd2d7df825e5295071e0eab4d32d6fbf06d0bbca5b98b25ceb
7
+ data.tar.gz: eebb3408aad44064bfafcbf4e1b3d9407af0e5bfa8782aaaffad8fd13be29a68351343c57d6b6a40dca769be972d7b6654ca45b7757d780cc3cddbc1c2825354
data/CHANGELOG.md CHANGED
@@ -1,2 +1,12 @@
1
+ ## 0.9.3
2
+ - CloudFlare API now works with start_id & count \o/
3
+
4
+ ## 0.9.2
5
+ - fixing situations when you have no visits and the API would be constantly requested
6
+ - fixed address in gemspec
7
+
8
+ ## 0.9.1
9
+ - first working version of plugin
10
+
1
11
  ## 0.1.0
2
- - Initial version of the Cloudflare input plugin
12
+ - Initial version of the Cloudflare input plugin
@@ -72,6 +72,7 @@ class LogStash::Inputs::Cloudflare < LogStash::Inputs::Base
72
72
  validate: :string, default: '/tmp/cf_logstash_metadata.json', required: false
73
73
  config :poll_time, validate: :number, default: 15, required: false
74
74
  config :start_from_secs_ago, validate: :number, default: 1200, required: false
75
+ config :batch_size, validate: :number, default: 1000, required: false
75
76
  config :fields, validate: :array, default: DEFAULT_FIELDS, required: false
76
77
 
77
78
  public
@@ -126,6 +127,7 @@ class LogStash::Inputs::Cloudflare < LogStash::Inputs::Base
126
127
  raise CloudflareAPIError.new(uri.to_s, response, content),
127
128
  'Error calling Cloudflare API'
128
129
  end
130
+ @logger.info("Received response from Cloudflare API (status_code: #{response.code})")
129
131
  lines = parse_content(content)
130
132
  return lines if multi_line
131
133
  return lines[0]
@@ -143,26 +145,13 @@ class LogStash::Inputs::Cloudflare < LogStash::Inputs::Base
143
145
 
144
146
  def cf_params(metadata)
145
147
  params = {}
146
- # if we have ray_id, we use that as a starting point and and use
147
- # timestamp + 120 seconds as end because the API doesn't support the
148
- # `count` parameter
149
- if metadata['last_ray_id'] && metadata['last_timestamp']
150
- dt_tstamp = DateTime.strptime("#{metadata['last_timestamp']}", '%s')
151
- @logger.info('last_ray_id from previous run detected: '\
152
- "#{metadata['last_ray_id']}")
153
- @logger.info('last_timestamp from previous run detected: '\
154
- "#{metadata['last_timestamp']} #{dt_tstamp}")
155
- params['start_id'] = metadata['last_ray_id']
156
- params['end'] = metadata['last_timestamp'].to_i + 120
157
- metadata['first_ray_id'] = metadata['last_ray_id']
148
+ # if we have ray_id, we use that as a starting point
149
+ if metadata['last_ray_id']
150
+ @logger.info("Previous ray_id detected: #{ray_id}")
151
+ params['start_id'] = ray_id
152
+ params['count'] = @batch_size
153
+ metadata['first_ray_id'] = ray_id
158
154
  metadata['first_timestamp'] = nil
159
- # not supported by the API yet which is why it's commented out
160
- # elsif ray_id
161
- # @logger.info("Previous ray_id detected: #{ray_id}")
162
- # params['start_id'] = ray_id
163
- # params['count'] = 100 # not supported in the API yet
164
- # metadata['first_ray_id'] = ray_id
165
- # metadata['first_timestamp'] = nil
166
155
  elsif metadata['last_timestamp']
167
156
  dt_tstamp = DateTime.strptime(metadata['last_timestamp'], '%s')
168
157
  @logger.info('last_timestamp from previous run detected: '\
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'logstash-input-cloudflare'
3
- s.version = '0.9.2'
3
+ s.version = '0.9.3'
4
4
  s.licenses = ['Apache License (2.0)']
5
5
  s.summary = 'This logstash input plugin fetches logs from Cloudflare using'\
6
6
  'their API'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-input-cloudflare
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.2
4
+ version: 0.9.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Igor Serko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-11 00:00:00.000000000 Z
11
+ date: 2016-08-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement