POST
/
cdn
/
logs_uploader
/
policies
Create policy
curl --request POST \
  --url https://api.gcore.com/cdn/logs_uploader/policies \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '{
  "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": "flvproxy",
  "tags": {},
  "related_uploader_configs": [
    123
  ]
}'
{
  "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": "flvproxy",
  "tags": {},
  "related_uploader_configs": [
    123
  ]
}

Authorizations

Authorization
string
header
required

API key for authentication. Make sure to include the word apikey, followed by a single space and then your token. Example: apikey 1234$abcdef

Body

application/json
include_empty_logs
boolean
default:false

Include empty logs in the upload.

include_shield_logs
boolean
default:false

Include logs from origin shielding in the upload.

name
string
default:Policy

Name of the policy.

Maximum length: 255
description
string

Description of the policy.

Maximum length: 255
retry_interval_minutes
integer
default:60

Interval in minutes to retry failed uploads.

Required range: 5 <= x <= 60
rotate_interval_minutes
integer
default:5

Interval in minutes to rotate logs.

Required range: 5 <= x <= 60
rotate_threshold_mb
integer | null

Threshold in MB to rotate logs.

Required range: 100 <= x <= 2147483647
rotate_threshold_lines
integer
default:0

Threshold in lines to rotate logs.

Required range: 0 <= x <= 10000
date_format
string

Date format for logs.

Maximum length: 255
field_delimiter
string
default:"

Field delimiter for logs.

Maximum length: 10
field_separator
string
default:

Field separator for logs.

Required string length: 1 - 10
fields
string[]

List of fields to include in logs.

file_name_template
string
default:{{YYYY}}/{{MM}}/{{DD}}/{{HH}}/{{mm}}/{{ss}}/{{HOST}}_{{CNAME}}_access.log.gz

Template for log file name.

Maximum length: 255
format_type
string

Format type for logs.

Maximum length: 255
tags
object

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.

Response

Successful.

id
integer
client_id
integer

Client that owns the policy.

created
string<date-time>

Time when logs uploader policy was created.

updated
string<date-time>

Time when logs uploader policy was updated.

include_empty_logs
boolean

Include empty logs in the upload.

include_shield_logs
boolean

Include logs from origin shielding in the upload.

name
string

Name of the policy.

Maximum length: 255
description
string

Description of the policy.

Maximum length: 255
retry_interval_minutes
integer

Interval in minutes to retry failed uploads.

Required range: 5 <= x <= 60
rotate_interval_minutes
integer

Interval in minutes to rotate logs.

Required range: 5 <= x <= 60
rotate_threshold_mb
integer | null

Threshold in MB to rotate logs.

Required range: 5 <= x <= 500
rotate_threshold_lines
integer

Threshold in lines to rotate logs.

Required range: 0 <= x <= 10000
date_format
string

Date format for logs.

Maximum length: 255
field_delimiter
string

Field delimiter for logs.

Maximum length: 10
Example:

";"

field_separator
string

Field separator for logs.

Required string length: 1 - 10
fields
string[]

List of fields to include in logs.

file_name_template
string

Template for log file name.

Maximum length: 255
format_type
string

Format type for logs.

Maximum length: 255
tags
object

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.

List of logs uploader configs that use this policy.