Skip to content

datadog list-logs

List logs that match query

Description

Returns paginated result of logs that match the log search query

Synopsis

datadog list-logs
    [--site <site>]
    [--query <query>]
    [--index <index>]
    [--from <from>]
    [--to <to>]
    [--storage_tier <storage_tier>]
    [--sort <sort>]
    [--cursor <cursor>]
    [--limit <limit>]

Arguments

site - (string)

     Site where this command will be executed
     Example: --site "site-1"
     Default: input.site      Attributes: optional

query - (string)

     Search query following logs syntax
     Example: --query "query-1"
     Default: _None_      Attributes: optional

index - (string)

     For customers with multiple indexes
     Example: --index "index-1"
     Default: _None_      Attributes: optional

from - (time)

     Minimum timestamp for requested logs
     Example: --from "2019-10-12T07:20:50.52Z"
     Default: 15 minutes ago      Attributes: optional

to - (time)

     Maximum timestamp for requested logs
     Example: --to "2019-10-12T07:20:50.52Z"
     Default: _None_      Attributes: optional

storage_tier - (string)

     Specifies the storage type to be used
     Example: --storage_tier "storage_tier-1"
     Default: _None_      Attributes: optional

     Validation:
         allowed values: indexes, online-archives

sort - (string)

     Order of logs in results
     Example: --sort "sort-1"
     Default: _None_      Attributes: optional

     Validation:
         allowed values: timestamp, -timestamp

cursor - (string)

     List following results with a cursor provided in the previous query
     Example: --cursor "cursor-1"
     Default: _None_      Attributes: optional

limit - (int)

     Maximum number of logs in the response.
     Example: --limit 1
     Default: _None_      Attributes: optional

Examples

Input:

!datadog list-logs --from "1 day ago"
Output:
ID                                      STATUS  MESSAGE         TAGS    TIMESTAMP
AgAAAYYLZOvglWzodQAAAAAAA             info    Button Clicked  team:A    2019-01-02T09:42:36.320Z

Access Control

To use this command, you need access to the following:

Field Value
Action "read"
Service Type "datadog"
Service Instance
Namespace
Object Type "log"
Object ID

Please see Access Control for details.