lib/datadog_api_client/v2/api/logs_api.rb
# Get a list of logs
# List endpoint returns logs that match a log search query.
# [Results are paginated][1].
#
# 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][2].**
#
# [1]: /logs/guide/collect-multiple-logs-with-pagination
# [2]: https://docs.datadoghq.com/logs/archives
# @param opts [Hash] 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 '*' 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
Get a list of logs
List endpoint returns logs that match a log search query.
[Results are paginated][1].

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][2].


Get a list of logs List endpoint returns logs that match a log search query . [ Results are paginated ] [ 1 ] . 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 ] [ 2 ] .
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
      allowable_values = ['timestamp', '-timestamp']
      if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort'])
        fail ArgumentError, "invalid value for \"sort\", must be one of #{allowable_values}"
      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
      local_var_path = '/api/v2/logs/events'
      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_params = opts[:header_params] || {}
      header_params['Accept'] = @api_client.select_header_accept(['application/json'])
      form_params = opts[:form_params] || {}
      post_body = opts[:debug_body]
      return_type = opts[:debug_return_type] || 'LogsListResponse'
      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
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 allowable_values = [ 'timestamp' , '-timestamp' ] if @api_client . config . client_side_validation && opts [ :' sort ' ] && ! allowable_values . include? ( opts [ :' sort ' ] ) fail ArgumentError , "invalid value for \"sort\", must be one of #{allowable_values}" 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 local_var_path = '/api/v2/logs/events' 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_params = opts [ :header_params ] || { } header_params [ 'Accept' ] = @api_client . select_header_accept ( [ 'application/json' ] ) form_params = opts [ :form_params ] || { } post_body = opts [ :debug_body ] return_type = opts [ :debug_return_type ] || 'LogsListResponse' 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
Get a list of logs
List endpoint returns logs that match a log search query.
Get a list of logs List endpoint returns logs that match a log search query .
# resource path # query parameters # header parameters # HTTP header 'Accept' (if needed) # form parameters # http body (model) # return_type # auth_names
LogsListResponse data, response status code and response headers
LogsListResponse data response status code and response headers
Array<(LogsListResponse, Integer, Hash)>
opts
:page_limit Maximum number of logs in the response.
: page_limit Maximum number of logs in the response .