> ## Documentation Index
> Fetch the complete documentation index at: https://gcore.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Get CDN logs

> Get CDN logs for up to 3 days starting today.

You can filter logs using query parameters by client IP, CDN resource, date, path and etc.

To filter the CDN logs by 2xx status codes, use:
- &`status__gte`=200&`status__lt`=300



## OpenAPI

````yaml /api-reference/services_documented/cdn_api.yaml get /cdn/advanced/v1/logs
openapi: 3.1.0
info:
  title: Gcore OpenAPI – CDN API
  description: >-
    This OpenAPI is an aggregated OpenAPI specification that unifies all Gcore
    products into a single file. It covers Cloud, CDN, DNS, WAAP, DDoS
    Protection, Object Storage, Streaming, and FastEdge services.
  version: '2026-05-07T20:33:46.548242+00:00'
servers:
  - url: https://api.gcore.com
security:
  - APIKey: []
tags:
  - name: CDN service
    description: Information about the current state of the CDN service in your account.
    x-displayName: CDN service
  - name: CDN resources
    x-displayName: CDN resources
  - name: Origins
    x-displayName: Origins
  - name: Rules
    description: >-
      Rules allow to set up custom settings for certain file types or paths.

      By default, the rule inherits all options values from the related CDN
      resource.


      Each option in rule settings can be in one of the following states:

      - **Inherit** - Option is not added to the rule. Option inherits its value
      from the CDN resource settings. In this case, the option value is
      **null**.

      - **ON** - Option is added to the rule and enabled. Option values
      configured in the rule will override values from the CDN resource
      settings.

      - **OFF** - Option is added to the rule and disabled. Option will be
      turned off.
    x-displayName: Rules
  - name: Rule templates
    x-displayName: Rule templates
  - name: SSL certificates
    x-displayName: SSL certificates
  - name: Let's Encrypt certificates
    x-displayName: Let's Encrypt certificates
  - name: CA certificates
    x-displayName: CA certificates
  - name: CDN activity logs
    description: |-
      Get the history of users requests to CDN.
      It contains requests made both via the API and via the control panel.

      The following methods are not tracked in the activity logs:
      - HEAD
      - OPTIONS
    x-displayName: CDN activity logs
  - name: Log viewer
    description: >-
      Log viewer provides you with general information about CDN operation. This
      information does not contain all possible

      sets of fields and restricted by time. To receive full data, use Logs
      Uploader.
    x-displayName: Log viewer
  - name: Logs uploader
    description: >-
      Logs uploader allows you to upload logs with desired format to desired
      storages.


      Consists of three main parts:

      - **Policies** - rules that define which logs are uploaded and how they
      are uploaded.

      - **Targets** - destinations where logs are uploaded.

      - **Configs** - combinations of logs uploader policies, targets and
      resources to which they are applied.
    x-displayName: Logs uploader
  - name: Tools
    x-displayName: Tools
  - name: CDN Statistics
    description: >-
      Consumption statistics is updated in near real-time as a standard
      practice.

      However, the frequency of updates can vary, but they are typically
      available within a 24-hour period.

      Exceptions, such as maintenance periods, may delay data beyond 24 hours
      until servers resume and fill in the missing statistics.
    x-displayName: Statistics
  - name: Advanced analytics
    description: >-
      Advanced analytics allows to get statistics about unique visitors,
      traffic, and requests for countries, directories, browsers, devices, and
      operation systems for up to 90 days starting from today.


      Advanced analytics API is based on the [GraphQL
      framework](https://graphql.org/).


      Advanced analytics API has one single endpoint:

       https://api.gcore.com/cdn/advanced/v2/query

      You can pass the query parameters as a JSON object in the payload of a
      POST request to this endpoint.

      You can use curl to make requests to the Advanced analytics API.
      Alternatively, you can use a GraphQL client

      to construct queries and pass requests to the Advanced analytics API.


      You can write queries in GraphQL much like in SQL: specify the data set
      (CDN resource), the metrics

      to retrieve (such as unique visitors and traffic), and filter or group by
      dimensions (for example, a country).
    x-displayName: Advanced analytics
  - name: Origin shielding
    x-displayName: Origin shielding
  - name: IP addresses list
    x-displayName: IP addresses list
  - name: Purge history
    x-displayName: Purge history
paths:
  /cdn/advanced/v1/logs:
    get:
      tags:
        - Log viewer
      summary: Get CDN logs
      description: >-
        Get CDN logs for up to 3 days starting today.


        You can filter logs using query parameters by client IP, CDN resource,
        date, path and etc.


        To filter the CDN logs by 2xx status codes, use:

        - &`status__gte`=200&`status__lt`=300
      operationId: get-cdn-logs
      parameters:
        - $ref: '#/components/parameters/from'
        - $ref: '#/components/parameters/to'
        - $ref: '#/components/parameters/parameters_query-offset'
        - $ref: '#/components/parameters/parameters_query-limit'
        - $ref: '#/components/parameters/ordering'
        - $ref: '#/components/parameters/fields'
        - $ref: '#/components/parameters/method__eq'
        - $ref: '#/components/parameters/method__ne'
        - $ref: '#/components/parameters/method__in'
        - $ref: '#/components/parameters/method__not_in'
        - $ref: '#/components/parameters/client_ip__eq'
        - $ref: '#/components/parameters/client_ip__ne'
        - $ref: '#/components/parameters/client_ip__in'
        - $ref: '#/components/parameters/client_ip__not_in'
        - $ref: '#/components/parameters/status__gt'
        - $ref: '#/components/parameters/status__gte'
        - $ref: '#/components/parameters/status__lt'
        - $ref: '#/components/parameters/status__lte'
        - $ref: '#/components/parameters/status__eq'
        - $ref: '#/components/parameters/status__ne'
        - $ref: '#/components/parameters/status__in'
        - $ref: '#/components/parameters/status__not_in'
        - $ref: '#/components/parameters/size__gt'
        - $ref: '#/components/parameters/size__gte'
        - $ref: '#/components/parameters/size__lt'
        - $ref: '#/components/parameters/size__lte'
        - $ref: '#/components/parameters/size__eq'
        - $ref: '#/components/parameters/size__ne'
        - $ref: '#/components/parameters/size__in'
        - $ref: '#/components/parameters/size__not_in'
        - $ref: '#/components/parameters/cname__eq'
        - $ref: '#/components/parameters/cname__ne'
        - $ref: '#/components/parameters/cname__in'
        - $ref: '#/components/parameters/cname__not_in'
        - $ref: '#/components/parameters/cname__contains'
        - $ref: '#/components/parameters/resource_id__gt'
        - $ref: '#/components/parameters/resource_id__gte'
        - $ref: '#/components/parameters/resource_id__lt'
        - $ref: '#/components/parameters/resource_id__lte'
        - $ref: '#/components/parameters/resource_id__eq'
        - $ref: '#/components/parameters/resource_id__ne'
        - $ref: '#/components/parameters/resource_id__in'
        - $ref: '#/components/parameters/resource_id__not_in'
        - $ref: '#/components/parameters/cache_status__eq'
        - $ref: '#/components/parameters/cache_status__ne'
        - $ref: '#/components/parameters/cache_status__in'
        - $ref: '#/components/parameters/cache_status__not_in'
        - $ref: '#/components/parameters/datacenter__eq'
        - $ref: '#/components/parameters/datacenter__ne'
        - $ref: '#/components/parameters/datacenter__in'
        - $ref: '#/components/parameters/datacenter__not_in'
      responses:
        '200':
          description: Successful.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetLogsResponse'
      x-codeSamples:
        - lang: Python
          source: |-
            import os
            from gcore import Gcore

            client = Gcore(
                api_key=os.environ.get("GCORE_API_KEY"),  # This is the default and can be omitted
            )
            page = client.cdn.logs.list(
                from_="from",
                to="to",
            )
            page = page.data[0]
            print(page.resource_id)
        - lang: Go
          source: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/G-Core/gcore-go\"\n\t\"github.com/G-Core/gcore-go/cdn\"\n\t\"github.com/G-Core/gcore-go/option\"\n)\n\nfunc main() {\n\tclient := gcore.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.CDN.Logs.List(context.TODO(), cdn.LogListParams{\n\t\tFrom: \"from\",\n\t\tTo:   \"to\",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n"
components:
  parameters:
    from:
      in: query
      name: from
      schema:
        type: string
      required: true
      description: >-
        Start date and time of the requested time period (ISO 8601/RFC 3339
        format, UTC.)


        Difference between "from" and "to" cannot exceed 6 hours.


        Examples:

        - &from=2021-06-14T00:00:00Z

        - &from=2021-06-14T00:00:00.000Z
    to:
      in: query
      name: to
      schema:
        type: string
      required: true
      description: >-
        End date and time of the requested time period (ISO 8601/RFC 3339
        format, UTC.)


        Difference between "from" and "to" cannot exceed 6 hours.


        Examples:

        - &to=2021-06-15T00:00:00Z

        - &to=2021-06-15T00:00:00.000Z
    parameters_query-offset:
      in: query
      name: offset
      schema:
        type: integer
        default: 0
      description: >-
        Number of log records to skip starting from the beginning of the
        requested period.
    parameters_query-limit:
      in: query
      name: limit
      schema:
        type: integer
        default: 100
        minimum: 1
        maximum: 1000
      description: Maximum number of log records in the response.
    ordering:
      in: query
      name: ordering
      schema:
        type: string
      description: >-
        Sorting rules.


        Possible values:

        - **method** - Request HTTP method.

        - **`client_ip`** - IP address of the client who sent the request.

        - **status** - Status code in the response.

        - **size** - Response size in bytes.

        - **cname** - Custom domain of the requested resource.

        - **`resource_id`** - ID of the requested CDN resource.

        - **`cache_status`** - Caching status.

        - **datacenter** - Data center where request was processed.

        - **timestamp** - Date and time when the request was made.


        Parameter may have multiple values separated by a comma.


        By default, ascending sorting is applied. To sort in descending order,
        add '-' prefix.


        Example:

        - &ordering=-timestamp,status
    fields:
      in: query
      name: fields
      schema:
        type: string
        default: >-
          timestamp,path,method,referer,user_agent,client_ip,status,size,cname,resource_id,cache_status,datacenter,sent_http_content_type,tcpinfo_rtt
      description: |-
        A comma-separated list of returned fields.

        Supported fields are presented in the responses section.

        Example:
        - &fields=timestamp,path,status
    method__eq:
      in: query
      name: method__eq
      schema:
        type: string
      description: >-
        Request HTTP method. Possible values: 'CONNECT', 'DELETE', 'GET',
        'HEAD', 'OPTIONS', 'PATCH', 'POST', 'PUT', 'TRACE'.
    method__ne:
      in: query
      name: method__ne
      schema:
        type: string
      description: >-
        Request HTTP method. Possible values: 'CONNECT', 'DELETE', 'GET',
        'HEAD', 'OPTIONS', 'PATCH', 'POST', 'PUT', 'TRACE'.
    method__in:
      in: query
      name: method__in
      schema:
        type: string
      description: >-
        Request HTTP method. Possible values: 'CONNECT', 'DELETE', 'GET',
        'HEAD', 'OPTIONS', 'PATCH', 'POST', 'PUT', 'TRACE'. Values should be
        separated by a comma.
    method__not_in:
      in: query
      name: method__not_in
      schema:
        type: string
      description: >-
        Request HTTP method. Possible values: 'CONNECT', 'DELETE', 'GET',
        'HEAD', 'OPTIONS', 'PATCH', 'POST', 'PUT', 'TRACE'. Values should be
        separated by a comma.
    client_ip__eq:
      in: query
      name: client_ip__eq
      schema:
        type: string
      description: IP address of the client who sent the request.
    client_ip__ne:
      in: query
      name: client_ip__ne
      schema:
        type: string
      description: IP address of the client who did not send the request.
    client_ip__in:
      in: query
      name: client_ip__in
      schema:
        type: string
      description: List of IP addresses of the clients who sent the request.
    client_ip__not_in:
      in: query
      name: client_ip__not_in
      schema:
        type: string
      description: List of IP addresses of the clients who did not send the request.
    status__gt:
      in: query
      name: status__gt
      schema:
        type: integer
      description: Status code in the response greater than the specified value.
    status__gte:
      in: query
      name: status__gte
      schema:
        type: integer
      description: >-
        Status code in the response greater than or equal to the specified
        value.
    status__lt:
      in: query
      name: status__lt
      schema:
        type: integer
      description: Status code in the response less than the specified value.
    status__lte:
      in: query
      name: status__lte
      schema:
        type: integer
      description: Status code in the response less than or equal to the specified value.
    status__eq:
      in: query
      name: status__eq
      schema:
        type: integer
      description: Status code in the response equal to the specified value.
    status__ne:
      in: query
      name: status__ne
      schema:
        type: integer
      description: Status code in the response not equal to the specified value.
    status__in:
      in: query
      name: status__in
      schema:
        type: string
      description: >-
        List of status codes in the response. Values should be separated by a
        comma.
    status__not_in:
      in: query
      name: status__not_in
      schema:
        type: string
      description: >-
        List of status codes not in the response. Values should be separated by
        a comma.
    size__gt:
      in: query
      name: size__gt
      schema:
        type: integer
      description: Response size in bytes greater than the specified value.
    size__gte:
      in: query
      name: size__gte
      schema:
        type: integer
      description: Response size in bytes greater than or equal to the specified value.
    size__lt:
      in: query
      name: size__lt
      schema:
        type: integer
      description: Response size in bytes less than the specified value.
    size__lte:
      in: query
      name: size__lte
      schema:
        type: integer
      description: Response size in bytes less than or equal to the specified value.
    size__eq:
      in: query
      name: size__eq
      schema:
        type: integer
      description: Response size in bytes equal to the specified value.
    size__ne:
      in: query
      name: size__ne
      schema:
        type: integer
      description: Response size in bytes not equal to the specified value.
    size__in:
      in: query
      name: size__in
      schema:
        type: string
      description: List of response sizes in bytes. Values should be separated by a comma.
    size__not_in:
      in: query
      name: size__not_in
      schema:
        type: string
      description: >-
        List of response sizes in bytes not equal to the specified values.
        Values should be separated by
    cname__eq:
      in: query
      name: cname__eq
      schema:
        type: string
      description: Custom domain of the requested CDN resource.
    cname__ne:
      in: query
      name: cname__ne
      schema:
        type: string
      description: >-
        Custom domain of the requested CDN resource not equal to the specified
        value.
    cname__in:
      in: query
      name: cname__in
      schema:
        type: string
      description: >-
        List of custom domains of the requested CDN resource. Values should be
        separated by a comma.
    cname__not_in:
      in: query
      name: cname__not_in
      schema:
        type: string
      description: >-
        List of custom domains of the requested CDN resource not equal to the
        specified values. Values should be separated by a comma.
    cname__contains:
      in: query
      name: cname__contains
      schema:
        type: string
      description: >-
        Part of the custom domain of the requested CDN resource. Minimum length
        is 3 characters.
    resource_id__gt:
      in: query
      name: resource_id__gt
      schema:
        type: integer
      description: ID of the requested CDN resource greater than the specified value.
    resource_id__gte:
      in: query
      name: resource_id__gte
      schema:
        type: integer
      description: >-
        ID of the requested CDN resource greater than or equal to the specified
        value.
    resource_id__lt:
      in: query
      name: resource_id__lt
      schema:
        type: integer
      description: ID of the requested CDN resource less than the specified value.
    resource_id__lte:
      in: query
      name: resource_id__lte
      schema:
        type: integer
      description: >-
        ID of the requested CDN resource less than or equal to the specified
        value.
    resource_id__eq:
      in: query
      name: resource_id__eq
      schema:
        type: integer
      description: ID of the requested CDN resource equal to the specified value.
    resource_id__ne:
      in: query
      name: resource_id__ne
      schema:
        type: integer
      description: ID of the requested CDN resource not equal to the specified value.
    resource_id__in:
      in: query
      name: resource_id__in
      schema:
        type: string
      description: >-
        List of IDs of the requested CDN resource. Values should be separated by
        a comma.
    resource_id__not_in:
      in: query
      name: resource_id__not_in
      schema:
        type: string
      description: >-
        List of IDs of the requested CDN resource not equal to the specified
        values. Values should be separated by a comma.
    cache_status__eq:
      in: query
      name: cache_status__eq
      schema:
        type: string
      description: >-
        Caching status. Possible values: 'MISS', 'BYPASS', 'EXPIRED', 'STALE',
        'PENDING', 'UPDATING', 'REVALIDATED', 'HIT', '-'.
    cache_status__ne:
      in: query
      name: cache_status__ne
      schema:
        type: string
      description: >-
        Caching status not equal to the specified value. Possible values:
        'MISS', 'BYPASS', 'EXPIRED', 'STALE', 'PENDING', 'UPDATING',
        'REVALIDATED', 'HIT', '-'.
    cache_status__in:
      in: query
      name: cache_status__in
      schema:
        type: string
      description: >-
        List of caching statuses. Possible values: 'MISS', 'BYPASS', 'EXPIRED',
        'STALE', 'PENDING', 'UPDATING', 'REVALIDATED', 'HIT', '-'. Values should
        be separated by a comma.
    cache_status__not_in:
      in: query
      name: cache_status__not_in
      schema:
        type: string
      description: >-
        List of caching statuses not equal to the specified values. Possible
        values: 'MISS', 'BYPASS', 'EXPIRED', 'STALE', 'PENDING', 'UPDATING',
        'REVALIDATED', 'HIT', '-'. Values should be separated by a comma.
    datacenter__eq:
      in: query
      name: datacenter__eq
      schema:
        type: string
      description: Data center where request was processed.
    datacenter__ne:
      in: query
      name: datacenter__ne
      schema:
        type: string
      description: Data center where request was not processed.
    datacenter__in:
      in: query
      name: datacenter__in
      schema:
        type: string
      description: >-
        List of data centers where request was processed. Values should be
        separated by a comma.
    datacenter__not_in:
      in: query
      name: datacenter__not_in
      schema:
        type: string
      description: >-
        List of data centers where request was not processed. Values should be
        separated by a comma.
  schemas:
    GetLogsResponse:
      type: object
      properties:
        data:
          type: array
          description: Contains requested logs.
          items:
            type: object
            properties:
              timestamp:
                type: integer
                description: Log timestamp.
                example: 1633914371
              client_ip:
                type: string
                description: IP address from that the request was received.
                example: 1.1.1.1
              cname:
                type: string
                description: CDN resource custom domain.
                example: test.domain.com
              resource_id:
                type: integer
                description: CDN resource ID.
                example: 100
              path:
                type: string
                description: Path requested.
                example: /awesome-site
              method:
                type: string
                description: HTTP method used in the request.
                example: GET
              user_agent:
                type: string
                description: Value of 'User-Agent' header.
                example: Mozilla/5.0 (compatible; MSIE 6.0; Windows 95; Trident/3.1)
              status:
                type: integer
                description: HTTP status code.
                example: 200
              size:
                type: integer
                description: Response size in bytes.
                example: 17340162
              cache_status:
                type: string
                description: 'Cache status: HIT, MISS, etc.'
                example: HIT
              datacenter:
                type: string
                description: Data center where the request was processed.
                example: m9
              referer:
                type: string
                description: Value of 'Referer' header.
                example: https://www.test.com/
              sent_http_content_type:
                type: string
                description: >-
                  Value of the Content-Type HTTP header, indicating the MIME
                  type of the resource being transmitted.
                example: image/jpeg
              tcpinfo_rtt:
                type: integer
                description: >-
                  Time required to transmit a complete TCP segment: from the
                  first bit to the last.
                example: 70
        meta:
          type: object
          description: Contains meta-information.
          properties:
            count:
              type: integer
              description: Total number of records which match given parameters.
              example: 129874732
  securitySchemes:
    APIKey:
      description: >-
        API key for authentication. Make sure to include the word `apikey`,
        followed by a single space and then your token.

        Example: `apikey 1234$abcdef`
      type: apiKey
      in: header
      name: Authorization

````