class DatadogAPIClient::V2::LogsAPI

Attributes

api_client[RW]

Public Class Methods

new(api_client = APIClient.default) click to toggle source
# File lib/datadog_api_client/v2/api/logs_api.rb, line 22
def initialize(api_client = APIClient.default)
  @api_client = api_client
end

Public Instance Methods

aggregate_logs(body, opts = {}) click to toggle source

Aggregate events The API endpoint to aggregate events into buckets and compute metrics and timeseries. @param body [LogsAggregateRequest] @param [Hash] opts the optional parameters @return [LogsAggregateResponse]

# File lib/datadog_api_client/v2/api/logs_api.rb, line 30
def aggregate_logs(body, opts = {})
  data, _status_code, _headers = aggregate_logs_with_http_info(body, opts)
  data
end
aggregate_logs_with_http_info(body, opts = {}) click to toggle source

Aggregate events The API endpoint to aggregate events into buckets and compute metrics and timeseries. @param body [LogsAggregateRequest] @param [Hash] opts the optional parameters @return [Array<(LogsAggregateResponse, Integer, Hash)>] LogsAggregateResponse data, response status code and response headers

# File lib/datadog_api_client/v2/api/logs_api.rb, line 40
def aggregate_logs_with_http_info(body, opts = {})

  if @api_client.config.unstable_operations.has_key?(:aggregate_logs)
    unstable_enabled = @api_client.config.unstable_operations[:aggregate_logs]
    if unstable_enabled
      @api_client.config.logger.warn format("Using unstable operation '%s'", "aggregate_logs")
    else
      raise APIError.new(message: format("Unstable operation '%s' is disabled", "aggregate_logs"))
    end
  end

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: LogsAPI.aggregate_logs ...'
  end
  # verify the required parameter 'body' is set
  if @api_client.config.client_side_validation && body.nil?
    fail ArgumentError, "Missing the required parameter 'body' when calling LogsAPI.aggregate_logs"
  end
  # resource path
  local_var_path = '/api/v2/logs/analytics/aggregate'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(body)

  # return_type
  return_type = opts[:debug_return_type] || 'LogsAggregateResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth]

  new_options = opts.merge(
    :operation => :aggregate_logs,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: LogsAPI#aggregate_logs\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
list_logs(opts = {}) click to toggle source

Search logs List endpoint returns logs that match a log search query. [Results are paginated]. Use this endpoint to build complex logs filtering and search. **If you are considering archiving logs for your organization, consider use of the Datadog archive capabilities instead of the log list API. See [Datadog Logs Archive documentation].** [1]: /logs/guide/collect-multiple-logs-with-pagination [2]: docs.datadoghq.com/logs/archives @param [Hash] opts the optional parameters @option opts [LogsListRequest] :body @return [LogsListResponse]

# File lib/datadog_api_client/v2/api/logs_api.rb, line 105
def list_logs(opts = {})
  data, _status_code, _headers = list_logs_with_http_info(opts)
  data
end
list_logs_get(opts = {}) click to toggle source

Get a list of logs List endpoint returns logs that match a log search query. [Results are paginated]. Use this endpoint to see your latest logs. **If you are considering archiving logs for your organization, consider use of the Datadog archive capabilities instead of the log list API. See [Datadog Logs Archive documentation].** [1]: /logs/guide/collect-multiple-logs-with-pagination [2]: docs.datadoghq.com/logs/archives @param [Hash] opts the optional parameters @option opts [String] :filter_query Search query following logs syntax. @option opts [String] :filter_index For customers with multiple indexes, the indexes to search Defaults to &#39;*&#39; which means all indexes @option opts [Time] :filter_from Minimum timestamp for requested logs. @option opts [Time] :filter_to Maximum timestamp for requested logs. @option opts [LogsSort] :sort Order of logs in results. @option opts [String] :page_cursor List following results with a cursor provided in the previous query. @option opts [Integer] :page_limit Maximum number of logs in the response. (default to 10) @return [LogsListResponse]

# File lib/datadog_api_client/v2/api/logs_api.rb, line 182
def list_logs_get(opts = {})
  data, _status_code, _headers = list_logs_get_with_http_info(opts)
  data
end
list_logs_get_with_http_info(opts = {}) click to toggle source

Get a list of logs List endpoint returns logs that match a log search query. [Results are paginated]. Use this endpoint to see your latest logs. **If you are considering archiving logs for your organization, consider use of the Datadog archive capabilities instead of the log list API. See [Datadog Logs Archive documentation].** [1]: /logs/guide/collect-multiple-logs-with-pagination [2]: docs.datadoghq.com/logs/archives @param [Hash] opts the optional parameters @option opts [String] :filter_query Search query following logs syntax. @option opts [String] :filter_index For customers with multiple indexes, the indexes to search Defaults to &#39;*&#39; which means all indexes @option opts [Time] :filter_from Minimum timestamp for requested logs. @option opts [Time] :filter_to Maximum timestamp for requested logs. @option opts [LogsSort] :sort Order of logs in results. @option opts [String] :page_cursor List following results with a cursor provided in the previous query. @option opts [Integer] :page_limit Maximum number of logs in the response. @return [Array<(LogsListResponse, Integer, Hash)>] LogsListResponse data, response status code and response headers

# File lib/datadog_api_client/v2/api/logs_api.rb, line 198
def list_logs_get_with_http_info(opts = {})

  if @api_client.config.unstable_operations.has_key?(:list_logs_get)
    unstable_enabled = @api_client.config.unstable_operations[:list_logs_get]
    if unstable_enabled
      @api_client.config.logger.warn format("Using unstable operation '%s'", "list_logs_get")
    else
      raise APIError.new(message: format("Unstable operation '%s' is disabled", "list_logs_get"))
    end
  end

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: LogsAPI.list_logs_get ...'
  end
  if @api_client.config.client_side_validation && !opts[:'page_limit'].nil? && opts[:'page_limit'] > 1000
    fail ArgumentError, 'invalid value for "opts[:"page_limit"]" when calling LogsAPI.list_logs_get, must be smaller than or equal to 1000.'
  end

  # resource path
  local_var_path = '/api/v2/logs/events'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'filter[query]'] = opts[:'filter_query'] if !opts[:'filter_query'].nil?
  query_params[:'filter[index]'] = opts[:'filter_index'] if !opts[:'filter_index'].nil?
  query_params[:'filter[from]'] = opts[:'filter_from'] if !opts[:'filter_from'].nil?
  query_params[:'filter[to]'] = opts[:'filter_to'] if !opts[:'filter_to'].nil?
  query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
  query_params[:'page[cursor]'] = opts[:'page_cursor'] if !opts[:'page_cursor'].nil?
  query_params[:'page[limit]'] = opts[:'page_limit'] if !opts[:'page_limit'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'LogsListResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth]

  new_options = opts.merge(
    :operation => :list_logs_get,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: LogsAPI#list_logs_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
list_logs_with_http_info(opts = {}) click to toggle source

Search logs List endpoint returns logs that match a log search query. [Results are paginated]. Use this endpoint to build complex logs filtering and search. **If you are considering archiving logs for your organization, consider use of the Datadog archive capabilities instead of the log list API. See [Datadog Logs Archive documentation].** [1]: /logs/guide/collect-multiple-logs-with-pagination [2]: docs.datadoghq.com/logs/archives @param [Hash] opts the optional parameters @option opts [LogsListRequest] :body @return [Array<(LogsListResponse, Integer, Hash)>] LogsListResponse data, response status code and response headers

# File lib/datadog_api_client/v2/api/logs_api.rb, line 115
def list_logs_with_http_info(opts = {})

  if @api_client.config.unstable_operations.has_key?(:list_logs)
    unstable_enabled = @api_client.config.unstable_operations[:list_logs]
    if unstable_enabled
      @api_client.config.logger.warn format("Using unstable operation '%s'", "list_logs")
    else
      raise APIError.new(message: format("Unstable operation '%s' is disabled", "list_logs"))
    end
  end

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: LogsAPI.list_logs ...'
  end
  # resource path
  local_var_path = '/api/v2/logs/events/search'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'body'])

  # return_type
  return_type = opts[:debug_return_type] || 'LogsListResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth]

  new_options = opts.merge(
    :operation => :list_logs,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: LogsAPI#list_logs\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end