> ## 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.

# Change policy

> Change logs uploader policy partially.



## OpenAPI

````yaml /api-reference/services_documented/cdn_api.yaml patch /cdn/logs_uploader/policies/{id}
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-15T06:37:28.230198+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/logs_uploader/policies/{id}:
    patch:
      tags:
        - Logs uploader
      summary: Change policy
      description: Change logs uploader policy partially.
      operationId: patch-policy
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PatchLogsUploaderPolicy'
      responses:
        '200':
          description: Successful.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LogsUploaderPolicyResponse'
        '400':
          description: You will receive an error with the invalid parameter mentioned.
        '403':
          description: Feature is disabled for your account.
        '404':
          description: Policy do not exist or has been deleted.
      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
            )
            logs_uploader_policy = client.cdn.logs_uploader.policies.update(
                id=0,
            )
            print(logs_uploader_policy.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\tlogsUploaderPolicy, err := client.CDN.LogsUploader.Policies.Update(\n\t\tcontext.TODO(),\n\t\t0,\n\t\tcdn.LogsUploaderPolicyUpdateParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", logsUploaderPolicy.ID)\n}\n"
components:
  schemas:
    PatchLogsUploaderPolicy:
      type: object
      properties:
        include_empty_logs:
          type: boolean
          description: Include empty logs in the upload.
        include_shield_logs:
          type: boolean
          description: Include logs from origin shielding in the upload.
        name:
          type: string
          description: Name of the policy.
          maxLength: 255
        description:
          type: string
          description: Description of the policy.
          maxLength: 255
        retry_interval_minutes:
          type: integer
          description: Interval in minutes to retry failed uploads.
          maximum: 60
          minimum: 5
        rotate_interval_minutes:
          type: integer
          description: Interval in minutes to rotate logs.
          maximum: 60
          minimum: 5
        rotate_threshold_mb:
          type: integer
          description: Threshold in MB to rotate logs.
          minimum: 100
          nullable: true
        rotate_threshold_lines:
          type: integer
          description: Threshold in lines to rotate logs.
          maximum: 10000
          minimum: 0
        date_format:
          type: string
          description: Date format for logs.
          maxLength: 255
        field_delimiter:
          type: string
          description: Field delimiter for logs.
          maxLength: 10
        field_separator:
          type: string
          description: Field separator for logs.
          minLength: 1
          maxLength: 10
        fields:
          type: array
          items:
            type: string
            maxLength: 255
          description: List of fields to include in logs.
        file_name_template:
          type: string
          description: Template for log file name.
          maxLength: 255
        format_type:
          type: string
          enum:
            - json
            - ''
          description: >-
            Format type for logs.


            Possible values:

            - **""** - empty, it means it will apply the format configurations
            from the policy.

            - **"json"** - output the logs as json lines.
          maxLength: 255
        tags:
          type: object
          description: >-
            Tags allow for dynamic decoration of logs by adding predefined
            fields to the log format. These tags serve as customizable key-value
            pairs that can be included in log entries to enhance context and
            readability.
          additionalProperties:
            type: string
            maxLength: 50
        escape_special_characters:
          type: boolean
          description: >-
            When set to true, the service sanitizes string values by escaping
            characters that may be unsafe for transport, logging, or downstream
            processing.


            The following categories of characters are escaped:

            - Control and non-printable characters

            - Quotation marks and escape characters

            - Characters outside the standard ASCII range


            The resulting output contains only printable ASCII characters.
        log_sample_rate:
          type: number
          format: float
          description: >-
            Sampling rate for logs. A value between 0 and 1 that determines the
            fraction of log entries to collect.


            - **1** - collect all logs (default).

            - **0.5** - collect approximately 50% of logs.

            - **0** - collect no logs (effectively disables logging without
            removing the policy).
          minimum: 0
          maximum: 1
      example:
        include_empty_logs: true
        include_shield_logs: true
        name: Policy
        description: New policy
        retry_interval_minutes: 32
        rotate_interval_minutes: 32
        rotate_threshold_mb: 252
        rotate_threshold_lines: 5000
        date_format: '[02/Jan/2006:15:04:05 -0700]'
        field_delimiter: ','
        field_separator: ;
        fields:
          - remote_addr
          - status
        file_name_template: '{{YYYY}}_{{MM}}_{{DD}}_{{HH}}_{{mm}}_{{ss}}_access.log.gz'
        format_type: json
        tags: {}
        log_sample_rate: 0.5
        related_uploader_configs:
          - 123
    LogsUploaderPolicyResponse:
      type: object
      properties:
        id:
          type: integer
          readOnly: true
        client_id:
          type: integer
          description: Client that owns the policy.
          readOnly: true
        created:
          type: string
          format: date-time
          readOnly: true
          description: Time when logs uploader policy was created.
        updated:
          type: string
          format: date-time
          readOnly: true
          description: Time when logs uploader policy was updated.
        include_empty_logs:
          type: boolean
          description: Include empty logs in the upload.
        include_shield_logs:
          type: boolean
          description: Include logs from origin shielding in the upload.
        name:
          type: string
          description: Name of the policy.
          maxLength: 255
        description:
          type: string
          description: Description of the policy.
          maxLength: 255
        retry_interval_minutes:
          type: integer
          description: Interval in minutes to retry failed uploads.
          maximum: 60
          minimum: 5
        rotate_interval_minutes:
          type: integer
          description: Interval in minutes to rotate logs.
          maximum: 60
          minimum: 5
        rotate_threshold_mb:
          type: integer
          description: Threshold in MB to rotate logs.
          maximum: 500
          minimum: 5
          nullable: true
        rotate_threshold_lines:
          type: integer
          description: Threshold in lines to rotate logs.
          maximum: 10000
          minimum: 0
        date_format:
          type: string
          description: Date format for logs.
          maxLength: 255
        field_delimiter:
          type: string
          description: Field delimiter for logs.
          maxLength: 10
          example: ;
        field_separator:
          type: string
          description: Field separator for logs.
          minLength: 1
          maxLength: 10
        fields:
          type: array
          items:
            type: string
            maxLength: 255
          description: List of fields to include in logs.
        file_name_template:
          type: string
          description: Template for log file name.
          maxLength: 255
        format_type:
          type: string
          enum:
            - json
            - ''
          description: >-
            Format type for logs.


            Possible values:

            - **""** - empty, it means it will apply the format configurations
            from the policy.

            - **"json"** - output the logs as json lines.
          maxLength: 255
        tags:
          type: object
          description: >-
            Tags allow for dynamic decoration of logs by adding predefined
            fields to the log format. These tags serve as customizable key-value
            pairs that can be included in log entries to enhance context and
            readability.
          additionalProperties:
            type: string
            maxLength: 50
        escape_special_characters:
          type: boolean
          description: >-
            When set to true, the service sanitizes string values by escaping
            characters that may be unsafe for transport, logging, or downstream
            processing.


            The following categories of characters are escaped:

            - Control and non-printable characters

            - Quotation marks and escape characters

            - Characters outside the standard ASCII range


            The resulting output contains only printable ASCII characters.
        log_sample_rate:
          type: number
          format: float
          description: >-
            Sampling rate for logs. A value between 0 and 1 that determines the
            fraction of log entries to collect.


            - **1** - collect all logs (default).

            - **0.5** - collect approximately 50% of logs.

            - **0** - collect no logs (effectively disables logging without
            removing the policy).
          minimum: 0
          maximum: 1
        related_uploader_configs:
          type: array
          items:
            type: integer
          description: List of logs uploader configs that use this policy.
      example:
        id: 123
        client_id: 123
        created: '2023-11-07T05:31:56Z'
        updated: '2023-11-07T05:31:56Z'
        include_empty_logs: true
        include_shield_logs: true
        name: Policy
        description: New policy
        retry_interval_minutes: 32
        rotate_interval_minutes: 32
        rotate_threshold_mb: 252
        rotate_threshold_lines: 5000
        date_format: '[02/Jan/2006:15:04:05 -0700]'
        field_delimiter: ','
        field_separator: ;
        fields:
          - remote_addr
          - status
        file_name_template: '{{YYYY}}_{{MM}}_{{DD}}_{{HH}}_{{mm}}_{{ss}}_access.log.gz'
        format_type: json
        tags: {}
        log_sample_rate: 1
        related_uploader_configs:
          - 123
  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

````