logstash-input-cloudflare_logs 0.1.5 → 0.1.6

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: 8a4efb776c6de31d04e26c795861a47d189df62c
4
- data.tar.gz: 9f14bf3aa68cce5c418fbed3e46dd7193b3114fa
3
+ metadata.gz: 97fb1c091585e0cf444cd4ae0da7857aa89c0ea5
4
+ data.tar.gz: ecf522d024c3ada5dc7ba31b95fd075307a2a97e
5
5
  SHA512:
6
- metadata.gz: ddc722d771362a8d7ce5a0b99954a2314348d83bf9c9536d4ccfd5e550d65da11c7bdb85dcd911755ea81349af29cbc042df0702cff5d268743f1170dbde8b92
7
- data.tar.gz: 947f70f8ae14010bf89f627b54a19e1513826845fea57c2f9d1b066828c6a08c6bde16f99630be749979377453e53820398f63927c07ac2784666fd133f5f42d
6
+ metadata.gz: 8c692e6a1461c80fa4649413e24d9cbf1c54e6b6e5aa5ef5a1a666587f425307e2f393cf433d407e061ea08327eb6993018c1d375fddd0b8861c813d20094f78
7
+ data.tar.gz: 74639dbf211adb9111fc71588a5042b5e9f7b8c3ee66a8ce0afe178dbfa0e996e618f38362c0fe4f2ba6fddf1e266b88e0d96888ae71b3d895999cb3dcf91504
@@ -53,7 +53,6 @@ class CloudflareAccess
53
53
  end
54
54
 
55
55
  def logs
56
- puts("https://api.cloudflare.com/client/v4/zones/#{domain}/logs/received?start=#{start_time}&end=#{end_time}&fields=#{fields.join(',')}")
57
56
  results = RestClient.get("https://api.cloudflare.com/client/v4/zones/#{domain}/logs/received?start=#{start_time}&end=#{end_time}&fields=#{fields.join(',')}", 'X-Auth-Email' => auth_email, 'X-Auth-Key' => auth_key)
58
57
  results.body.split("\n").collect { |raw_log| JSON.parse(raw_log) }
59
58
  end
@@ -69,6 +68,7 @@ class LogStash::Inputs::CloudflareLogs < LogStash::Inputs::Base
69
68
  config :auth_key, validates: :string, required: true
70
69
  config :domain_key, validates: :string, required: true
71
70
  config :metadata_file, validates: :string, default: '/etc/logstash/cf_metadata.json'
71
+ config :environment_name, validates: :string
72
72
 
73
73
  config :interval, validate: :number, default: 600
74
74
 
@@ -86,6 +86,8 @@ class LogStash::Inputs::CloudflareLogs < LogStash::Inputs::Base
86
86
  def process_logs(queue)
87
87
  cloudflare_access.logs.each do |log|
88
88
  event = LogStash::Event.new(log)
89
+ log['fields.type'] = 'cloudflare'
90
+ log['fields.env'] = @environment_name
89
91
  decorate(event)
90
92
  queue << event
91
93
  end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'logstash-input-cloudflare_logs'
3
- s.version = '0.1.5'
3
+ s.version = '0.1.6'
4
4
  s.licenses = ['Apache License (2.0)']
5
5
  s.summary = 'write cloudflare logs to logstash'
6
6
  s.description = 'Write cloudflare lgos to logstash.' \
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-input-cloudflare_logs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh Moore