Skip to content
Start here

Get Logpush job details

client.Logpush.Jobs.Get(ctx, jobID, query) (*LogpushJob, error)
GET/{accounts_or_zones}/{account_or_zone_id}/logpush/jobs/{job_id}

Gets the details of a Logpush job.

Security
API Token

The preferred authorization scheme for interacting with the Cloudflare API. Create a token.

Example:Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY
API Email + API Key

The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.

Example:X-Auth-Email: user@example.com

The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.

Example:X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194
Accepted Permissions (at least one required)
Logs Write
ParametersExpand Collapse
jobID int64

Unique id of the job.

minimum1
query JobGetParams
AccountID param.Field[string]optional

The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.

ZoneID param.Field[string]optional

The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.

ReturnsExpand Collapse
type LogpushJob struct{…}
ID int64optional

Unique id of the job.

minimum1
Dataset LogpushJobDatasetoptional

Name of the dataset. A list of supported datasets can be found on the Developer Docs.

One of the following:
const LogpushJobDatasetAccessRequests LogpushJobDataset = "access_requests"
const LogpushJobDatasetAuditLogs LogpushJobDataset = "audit_logs"
const LogpushJobDatasetAuditLogsV2 LogpushJobDataset = "audit_logs_v2"
const LogpushJobDatasetBISOUserActions LogpushJobDataset = "biso_user_actions"
const LogpushJobDatasetCasbFindings LogpushJobDataset = "casb_findings"
const LogpushJobDatasetDevicePostureResults LogpushJobDataset = "device_posture_results"
const LogpushJobDatasetDEXApplicationTests LogpushJobDataset = "dex_application_tests"
const LogpushJobDatasetDEXDeviceStateEvents LogpushJobDataset = "dex_device_state_events"
const LogpushJobDatasetDLPForensicCopies LogpushJobDataset = "dlp_forensic_copies"
const LogpushJobDatasetDNSFirewallLogs LogpushJobDataset = "dns_firewall_logs"
const LogpushJobDatasetDNSLogs LogpushJobDataset = "dns_logs"
const LogpushJobDatasetEmailSecurityAlerts LogpushJobDataset = "email_security_alerts"
const LogpushJobDatasetFirewallEvents LogpushJobDataset = "firewall_events"
const LogpushJobDatasetGatewayDNS LogpushJobDataset = "gateway_dns"
const LogpushJobDatasetGatewayHTTP LogpushJobDataset = "gateway_http"
const LogpushJobDatasetGatewayNetwork LogpushJobDataset = "gateway_network"
const LogpushJobDatasetHTTPRequests LogpushJobDataset = "http_requests"
const LogpushJobDatasetIPSECLogs LogpushJobDataset = "ipsec_logs"
const LogpushJobDatasetMagicIDsDetections LogpushJobDataset = "magic_ids_detections"
const LogpushJobDatasetNELReports LogpushJobDataset = "nel_reports"
const LogpushJobDatasetNetworkAnalyticsLogs LogpushJobDataset = "network_analytics_logs"
const LogpushJobDatasetPageShieldEvents LogpushJobDataset = "page_shield_events"
const LogpushJobDatasetSinkholeHTTPLogs LogpushJobDataset = "sinkhole_http_logs"
const LogpushJobDatasetSpectrumEvents LogpushJobDataset = "spectrum_events"
const LogpushJobDatasetSSHLogs LogpushJobDataset = "ssh_logs"
const LogpushJobDatasetWARPConfigChanges LogpushJobDataset = "warp_config_changes"
const LogpushJobDatasetWARPToggleChanges LogpushJobDataset = "warp_toggle_changes"
const LogpushJobDatasetWorkersTraceEvents LogpushJobDataset = "workers_trace_events"
const LogpushJobDatasetZarazEvents LogpushJobDataset = "zaraz_events"
const LogpushJobDatasetZeroTrustNetworkSessions LogpushJobDataset = "zero_trust_network_sessions"
DestinationConf stringoptional

Uniquely identifies a resource (such as an s3 bucket) where data. will be pushed. Additional configuration parameters supported by the destination may be included.

formaturi
maxLength4096
Enabled booloptional

Flag that indicates if the job is enabled.

ErrorMessage stringoptional

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

DeprecatedFrequency LogpushJobFrequencyoptional

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

One of the following:
const LogpushJobFrequencyHigh LogpushJobFrequency = "high"
const LogpushJobFrequencyLow LogpushJobFrequency = "low"
Kind LogpushJobKindoptional

The kind parameter (optional) is used to differentiate between Logpush and Edge Log Delivery jobs (when supported by the dataset).

One of the following:
const LogpushJobKindEmpty LogpushJobKind = ""
const LogpushJobKindEdge LogpushJobKind = "edge"
LastComplete Timeoptional

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.

formatdate-time
LastError Timeoptional

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.

formatdate-time
DeprecatedLogpullOptions stringoptional

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.

formaturi-reference
maxLength4096
MaxUploadBytes LogpushJobMaxUploadBytesoptional

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

One of the following:
type LogpushJobMaxUploadBytes int64

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

int64
MaxUploadIntervalSeconds LogpushJobMaxUploadIntervalSecondsoptional

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

One of the following:
type LogpushJobMaxUploadIntervalSeconds int64

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

int64
MaxUploadRecords LogpushJobMaxUploadRecordsoptional

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

One of the following:
type LogpushJobMaxUploadRecords int64

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

int64
Name stringoptional

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

maxLength512
OutputOptions OutputOptionsoptional

The structured replacement for logpull_options. When including this field, the logpull_option field will be ignored.

BatchPrefix stringoptional

String to be prepended before each batch.

BatchSuffix stringoptional

String to be appended after each batch.

Cve2021_44228 booloptional

If set to true, will cause all occurrences of ${ in the generated files to be replaced with x{.

FieldDelimiter stringoptional

String to join fields. This field be ignored when record_template is set.

FieldNames []stringoptional

List of field names to be included in the Logpush output. For the moment, there is no option to add all fields at once, so you must specify all the fields names you are interested in.

MergeSubrequests booloptional

If set to true, subrequests will be merged into the parent request. Only supported for the http_requests dataset.

OutputType OutputOptionsOutputTypeoptional

Specifies the output type, such as ndjson or csv. This sets default values for the rest of the settings, depending on the chosen output type. Some formatting rules, like string quoting, are different between output types.

One of the following:
const OutputOptionsOutputTypeNdjson OutputOptionsOutputType = "ndjson"
const OutputOptionsOutputTypeCsv OutputOptionsOutputType = "csv"
RecordDelimiter stringoptional

String to be inserted in-between the records as separator.

RecordPrefix stringoptional

String to be prepended before each record.

RecordSuffix stringoptional

String to be appended after each record.

RecordTemplate stringoptional

String to use as template for each record instead of the default json key value mapping. All fields used in the template must be present in field_names as well, otherwise they will end up as null. Format as a Go text/template without any standard functions, like conditionals, loops, sub-templates, etc.

SampleRate float64optional

Floating number to specify sampling rate. Sampling is applied on top of filtering, and regardless of the current sample_interval of the data.

formatfloat
maximum1
minimum0
TimestampFormat OutputOptionsTimestampFormatoptional

String to specify the format for timestamps, such as unixnano, unix, rfc3339, rfc3339ms or rfc3339ns.

One of the following:
const OutputOptionsTimestampFormatUnixnano OutputOptionsTimestampFormat = "unixnano"
const OutputOptionsTimestampFormatUnix OutputOptionsTimestampFormat = "unix"
const OutputOptionsTimestampFormatRfc3339 OutputOptionsTimestampFormat = "rfc3339"
const OutputOptionsTimestampFormatRfc3339ms OutputOptionsTimestampFormat = "rfc3339ms"
const OutputOptionsTimestampFormatRfc3339ns OutputOptionsTimestampFormat = "rfc3339ns"

Get Logpush job details

package main

import (
  "context"
  "fmt"

  "github.com/cloudflare/cloudflare-go"
  "github.com/cloudflare/cloudflare-go/logpush"
  "github.com/cloudflare/cloudflare-go/option"
)

func main() {
  client := cloudflare.NewClient(
    option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
  )
  logpushJob, err := client.Logpush.Jobs.Get(
    context.TODO(),
    int64(1),
    logpush.JobGetParams{

    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", logpushJob.ID)
}
{
  "errors": [],
  "messages": [],
  "result": {
    "dataset": "gateway_dns",
    "destination_conf": "s3://mybucket/logs?region=us-west-2",
    "enabled": false,
    "error_message": null,
    "filter": "{\"where\":{\"and\":[{\"key\":\"ClientRequestPath\",\"operator\":\"contains\",\"value\":\"/static\"},{\"key\":\"ClientRequestHost\",\"operator\":\"eq\",\"value\":\"example.com\"}]}}",
    "id": 1,
    "kind": "",
    "last_complete": null,
    "last_error": null,
    "max_upload_bytes": 5000000,
    "max_upload_interval_seconds": 30,
    "max_upload_records": 1000,
    "name": "example.com",
    "output_options": {
      "CVE-2021-44228": false,
      "batch_prefix": "",
      "batch_suffix": "",
      "field_delimiter": ",",
      "field_names": [
        "Datetime",
        "DstIP",
        "SrcIP"
      ],
      "output_type": "ndjson",
      "record_delimiter": "",
      "record_prefix": "{",
      "record_suffix": "}\n",
      "sample_rate": 1,
      "timestamp_format": "unixnano"
    }
  },
  "success": true
}
Returns Examples
{
  "errors": [],
  "messages": [],
  "result": {
    "dataset": "gateway_dns",
    "destination_conf": "s3://mybucket/logs?region=us-west-2",
    "enabled": false,
    "error_message": null,
    "filter": "{\"where\":{\"and\":[{\"key\":\"ClientRequestPath\",\"operator\":\"contains\",\"value\":\"/static\"},{\"key\":\"ClientRequestHost\",\"operator\":\"eq\",\"value\":\"example.com\"}]}}",
    "id": 1,
    "kind": "",
    "last_complete": null,
    "last_error": null,
    "max_upload_bytes": 5000000,
    "max_upload_interval_seconds": 30,
    "max_upload_records": 1000,
    "name": "example.com",
    "output_options": {
      "CVE-2021-44228": false,
      "batch_prefix": "",
      "batch_suffix": "",
      "field_delimiter": ",",
      "field_names": [
        "Datetime",
        "DstIP",
        "SrcIP"
      ],
      "output_type": "ndjson",
      "record_delimiter": "",
      "record_prefix": "{",
      "record_suffix": "}\n",
      "sample_rate": 1,
      "timestamp_format": "unixnano"
    }
  },
  "success": true
}