Skip to main content

jobs

Creates, updates, deletes, gets or lists a jobs resource.

Overview

Namejobs
TypeResource
Idcloudflare.logpush.jobs

Fields

The following fields are returned by SELECT queries:

Get Logpush job details response.

NameDatatypeDescription
idintegerUnique id of the job.
namestringOptional human readable job name. Not unique. Cloudflare suggests. that you set this to a meaningful string, like the domain name, to make it easier to identify your job. (example: example.com)
datasetstringName of the dataset. A list of supported datasets can be found on the Developer Docs. (access_requests, audit_logs, audit_logs_v2, biso_user_actions, casb_findings, device_posture_results, dex_application_tests, dex_device_state_events, dlp_forensic_copies, dns_firewall_logs, dns_logs, email_security_alerts, email_security_post_delivery_events, firewall_events, gateway_dns, gateway_http, gateway_network, http_requests, ipsec_logs, magic_ids_detections, mcp_portal_logs, nel_reports, network_analytics_logs, page_shield_events, sinkhole_http_logs, spectrum_events, ssh_logs, warp_config_changes, warp_toggle_changes, workers_trace_events, zaraz_events, zero_trust_network_sessions) (default: http_requests, example: http_requests)
destination_confstring (uri)Uniquely identifies a resource (such as an s3 bucket) where data. will be pushed. Additional configuration parameters supported by the destination may be included. (example: s3://mybucket/logs?region=us-west-2)
enabledbooleanFlag that indicates if the job is enabled.
error_messagestringIf not null, the job is currently failing. Failures are usually. repetitive (example: no permissions to write to destination bucket). Only the last failure is recorded. On successful execution of a job the error_message and last_error are set to null.
frequencystringThis field is deprecated. Please use max_upload_* parameters instead. . The frequency at which Cloudflare sends batches of logs to your destination. Setting frequency to high sends your logs in larger quantities of smaller files. Setting frequency to low sends logs in smaller quantities of larger files. (high, low) (default: high, example: high)
kindstringThe kind parameter (optional) is used to differentiate between Logpush and Edge Log Delivery jobs (when supported by the dataset). (, edge) (default: , example: , x-stainless-terraform-configurability: computed_optional)
last_completestring (date-time)Records the last time for which logs have been successfully pushed. If the last successful push was for logs range 2018-07-23T10:00:00Z to 2018-07-23T10:01:00Z then the value of this field will be 2018-07-23T10:01:00Z. If the job has never run or has just been enabled and hasn't run yet then the field will be empty.
last_errorstring (date-time)Records the last time the job failed. If not null, the job is currently. failing. If null, the job has either never failed or has run successfully at least once since last failure. See also the error_message field.
logpull_optionsstring (uri-reference)This field is deprecated. Use output_options instead. Configuration string. It specifies things like requested fields and timestamp formats. If migrating from the logpull api, copy the url (full url or just the query string) of your call here, and logpush will keep on making this call for you, setting start and end times appropriately. (example: fields=RayID,ClientIP,EdgeStartTimestamp&timestamps=rfc3339)
max_upload_bytesintegerThe maximum uncompressed file size of a batch of logs. This setting value must be between 5 MB and 1 GB, or 0 to disable it. Note that you cannot set a minimum file size; this means that log files may be much smaller than this batch size. (0)
max_upload_interval_secondsintegerThe maximum interval in seconds for log batches. This setting must be between 30 and 300 seconds (5 minutes), or 0 to disable it. Note that you cannot specify a minimum interval for log batches; this means that log files may be sent in shorter intervals than this. (0)
max_upload_recordsintegerThe maximum number of log lines per batch. This setting must be between 1000 and 1,000,000 lines, or 0 to disable it. Note that you cannot specify a minimum number of log lines per batch; this means that log files may contain many fewer lines than this. (0)
output_optionsobjectThe structured replacement for logpull_options. When including this field, the logpull_option field will be ignored.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_by_accountselectjob_id, account_idGets the details of a Logpush job.
get_by_zoneselectjob_id, zone_idGets the details of a Logpush job.
create_by_accountinsertaccount_id, destination_confCreates a new Logpush job for an account or zone.
create_by_zoneinsertzone_id, destination_confCreates a new Logpush job for an account or zone.
update_by_accountreplacejob_id, account_idUpdates a Logpush job.
update_by_zonereplacejob_id, zone_idUpdates a Logpush job.
delete_by_accountdeletejob_id, account_idDeletes a Logpush job.
delete_by_zonedeletejob_id, zone_idDeletes a Logpush job.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
account_idstringThe Cloudflare account ID.
job_idstringThe job ID.
zone_idstringThe Cloudflare zone ID.

SELECT examples

Gets the details of a Logpush job.

SELECT
id,
name,
dataset,
destination_conf,
enabled,
error_message,
frequency,
kind,
last_complete,
last_error,
logpull_options,
max_upload_bytes,
max_upload_interval_seconds,
max_upload_records,
output_options
FROM cloudflare.logpush.jobs
WHERE job_id = '{{ job_id }}' -- required
AND account_id = '{{ account_id }}' -- required
;

INSERT examples

Creates a new Logpush job for an account or zone.

INSERT INTO cloudflare.logpush.jobs (
dataset,
destination_conf,
enabled,
filter,
frequency,
kind,
logpull_options,
max_upload_bytes,
max_upload_interval_seconds,
max_upload_records,
name,
output_options,
ownership_challenge,
account_id
)
SELECT
'{{ dataset }}',
'{{ destination_conf }}' /* required */,
{{ enabled }},
'{{ filter }}',
'{{ frequency }}',
'{{ kind }}',
'{{ logpull_options }}',
{{ max_upload_bytes }},
{{ max_upload_interval_seconds }},
{{ max_upload_records }},
'{{ name }}',
'{{ output_options }}',
'{{ ownership_challenge }}',
'{{ account_id }}'
RETURNING
errors,
messages,
result,
success
;

REPLACE examples

Updates a Logpush job.

REPLACE cloudflare.logpush.jobs
SET
destination_conf = '{{ destination_conf }}',
enabled = {{ enabled }},
filter = '{{ filter }}',
frequency = '{{ frequency }}',
kind = '{{ kind }}',
logpull_options = '{{ logpull_options }}',
max_upload_bytes = {{ max_upload_bytes }},
max_upload_interval_seconds = {{ max_upload_interval_seconds }},
max_upload_records = {{ max_upload_records }},
name = '{{ name }}',
output_options = '{{ output_options }}',
ownership_challenge = '{{ ownership_challenge }}'
WHERE
job_id = '{{ job_id }}' --required
AND account_id = '{{ account_id }}' --required
RETURNING
errors,
messages,
result,
success;

DELETE examples

Deletes a Logpush job.

DELETE FROM cloudflare.logpush.jobs
WHERE job_id = '{{ job_id }}' --required
AND account_id = '{{ account_id }}' --required
;