Class: CloudflareClient::Zone::Log
- Inherits:
-
Base
- Object
- CloudflareClient
- CloudflareClient::Zone
- Base
- CloudflareClient::Zone::Log
- Defined in:
- lib/cloudflare_client/zone/log.rb
Constant Summary
Constants inherited from CloudflareClient::Zone
Constants inherited from CloudflareClient
API_BASE, POSSIBLE_API_SETTINGS, VALID_BUNDLE_METHODS, VALID_DIRECTIONS, VALID_MATCHES, VERSION
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#list_by_time(start_time: nil, end_time: nil, count: nil) ⇒ Object
get logs using only timestamps.
-
#list_since(ray_id:, end_time: nil, count: nil) ⇒ Object
get all logs after a given ray_id.
-
#show(ray_id:) ⇒ Object
get a single log entry by it’s ray_id.
Methods inherited from Base
Methods inherited from CloudflareClient::Zone
#create_zone, #delete_zone, #edit_zone, #purge_zone_cache, #update_zone_settings, #zone, #zone_activation_check, #zone_setting, #zone_settings, #zones
Methods inherited from CloudflareClient
Constructor Details
This class inherits a constructor from CloudflareClient::Zone::Base
Instance Method Details
#list_by_time(start_time: nil, end_time: nil, count: nil) ⇒ Object
get logs using only timestamps
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/cloudflare_client/zone/log.rb', line 9 def list_by_time(start_time: nil, end_time: nil, count: nil) (:end_time, end_time) unless end_time.nil? params = Hash.new minute = 60 if start_time.nil? params[:start] = (Time.now - (20 * minute)).to_i else (:start_time, start_time) params[:start] = start_time end if end_time.nil? params[:end] = (Time.now - (5 * minute)).to_i else (:end_time, end_time) params[:end] = end_time end params[:count] = 1000 params[:count] = count unless count.nil? cf_get(path: "/zones/#{zone_id}/logs/received", params: params, extra_headers: {'Accept-encoding': 'gzip'}) end |
#list_since(ray_id:, end_time: nil, count: nil) ⇒ Object
get all logs after a given ray_id. end_time must be a valid unix timestamp
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/cloudflare_client/zone/log.rb', line 49 def list_since(ray_id:, end_time: nil, count: nil) params = {start_id: ray_id} unless end_time.nil? (:end_time, end_time) params[:end] = end_time end params[:count] = count unless count.nil? params[:count] = 500 cf_get( path: "/zones/#{zone_id}/logs/received", params: params, extra_headers: {'Accept-encoding': 'gzip'} ) end |
#show(ray_id:) ⇒ Object
get a single log entry by it’s ray_id
Now lives under logs/rayids as detailed here: support.cloudflare.com/hc/en-us/articles/115003165991-Enterprise-Log-Share-ELS-Migrating-to-New-Endpoint
41 42 43 44 45 |
# File 'lib/cloudflare_client/zone/log.rb', line 41 def show(ray_id:) id_check(:ray_id, ray_id) cf_get(path: "/zones/#{zone_id}/logs/rayids/#{ray_id}") end |