For AI agents: A markdown version of this page is available at https://dnd37xeb23o8n.cloudfront.net/jen.gilbert/astro-base/fr/api/latest/ci-visibility-logs/send-ci-job-logs.md. A documentation index is available at /llms.txt.
Language
Datadog site

Send CI job logs

POSThttps://http-intake.logs.datadoghq.com/api/v2/cilogshttps://http-intake.logs.us3.datadoghq.com/api/v2/cilogshttps://http-intake.logs.us5.datadoghq.com/api/v2/cilogshttps://http-intake.logs.datadoghq.eu/api/v2/cilogshttps://http-intake.logs.ap1.datadoghq.com/api/v2/cilogshttps://http-intake.logs.ap2.datadoghq.com/api/v2/cilogshttps://http-intake.logs.uk1.datadoghq.com/api/v2/cilogsNot supported in the US1-FED regionNot supported in the US2-FED region

Présentation

Send log lines for a CI job over HTTP. See the CI Visibility Pipelines API for submitting the associated pipeline and job events.

A request can contain one log object or an array of up to 1,000 log objects. The maximum uncompressed request body size is 5.1 MiB.

You can stream log lines while a CI job runs or send them after it finishes. After you submit the completed job event, 20 seconds without a new log line marks the job's logs as complete. Lines sent after that may not appear.

A job can have up to 128 additional attributes and 256 tags. Additional attributes are top-level fields with string, number, Boolean, or null values. Nested objects and arrays are rejected. Additional attributes and ddtags apply to all log lines in the job. If an additional attribute has different values on different lines, the first value received is used. Tags supplied on different lines are combined. A job can contain up to 2,000,000 log records or 1 GiB of message bytes in total.

To reduce request size, send gzip-compressed JSON with the Content-Encoding: gzip header. Retry requests after a 408, 429, 500, or 503 response.

Arguments

Paramètres d'en-tête

Name
Type
Description
Content-Encoding
enum

HTTP header used to compress the JSON request body.

Allowed enum values: identity, gzip

Requête

Body Data (required)

CI job log line or batch in JSON format.

Champ
Type
Description
ddtags
string

Comma-separated key:value tags. A job can have up to 256 tags, including repeated keys.

job_id [required]
string

The job event's resource.id, sent through the CI Visibility pipeline API.

line_number
int64

The line number in the job log. Use 0 or 1 for the first line.

message [required]
string

The non-empty log line message.

pipeline_unique_id [required]
string

The resource.unique_id of the pipeline event, which must also match the job event's resource.pipeline_unique_id.

provider_name
string

The provider name sent with the pipeline event. It defaults to custom when omitted and, when provided, must be non-empty and cannot contain a comma.

section_name
string

The provider-defined section containing this log line, used to display collapsible groups of lines in the CI job log view.

status
string

The status of this log line. Any string is accepted. Datadog maps non-empty values to a standard log status. See status mapping.

timestamp
date-time

The log line time in RFC 3339 format with an explicit timezone. If omitted, the intake time is used. It can be at most 18 hours in the past or 12 hours in the future.

Réponse

Request accepted for processing

No response body

Exemple de code

Send batched CI job logs returns "Request accepted for processing" response
# Set your Datadog site and credentials
export DD_SITE="datadoghq.com"
export DD_API_KEY="<DD_API_KEY>"

curl -X POST "https://http-intake.logs.${DD_SITE}/api/v2/cilogs" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-d @- << EOF
[
  {
    "message": "Starting tests",
    "pipeline_unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a",
    "job_id": "job-456",
    "line_number": 1,
    "status": "notice",
    "section_name": "tests"
  },
  {
    "message": "Tests passed",
    "pipeline_unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a",
    "job_id": "job-456",
    "line_number": 2
  }
]
EOF
# Set your Datadog site and credentials
export DD_SITE="us3.datadoghq.com"
export DD_API_KEY="<DD_API_KEY>"

curl -X POST "https://http-intake.logs.${DD_SITE}/api/v2/cilogs" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-d @- << EOF
[
  {
    "message": "Starting tests",
    "pipeline_unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a",
    "job_id": "job-456",
    "line_number": 1,
    "status": "notice",
    "section_name": "tests"
  },
  {
    "message": "Tests passed",
    "pipeline_unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a",
    "job_id": "job-456",
    "line_number": 2
  }
]
EOF
# Set your Datadog site and credentials
export DD_SITE="us5.datadoghq.com"
export DD_API_KEY="<DD_API_KEY>"

curl -X POST "https://http-intake.logs.${DD_SITE}/api/v2/cilogs" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-d @- << EOF
[
  {
    "message": "Starting tests",
    "pipeline_unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a",
    "job_id": "job-456",
    "line_number": 1,
    "status": "notice",
    "section_name": "tests"
  },
  {
    "message": "Tests passed",
    "pipeline_unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a",
    "job_id": "job-456",
    "line_number": 2
  }
]
EOF
# Set your Datadog site and credentials
export DD_SITE="datadoghq.eu"
export DD_API_KEY="<DD_API_KEY>"

curl -X POST "https://http-intake.logs.${DD_SITE}/api/v2/cilogs" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-d @- << EOF
[
  {
    "message": "Starting tests",
    "pipeline_unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a",
    "job_id": "job-456",
    "line_number": 1,
    "status": "notice",
    "section_name": "tests"
  },
  {
    "message": "Tests passed",
    "pipeline_unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a",
    "job_id": "job-456",
    "line_number": 2
  }
]
EOF
# Set your Datadog site and credentials
export DD_SITE="ap1.datadoghq.com"
export DD_API_KEY="<DD_API_KEY>"

curl -X POST "https://http-intake.logs.${DD_SITE}/api/v2/cilogs" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-d @- << EOF
[
  {
    "message": "Starting tests",
    "pipeline_unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a",
    "job_id": "job-456",
    "line_number": 1,
    "status": "notice",
    "section_name": "tests"
  },
  {
    "message": "Tests passed",
    "pipeline_unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a",
    "job_id": "job-456",
    "line_number": 2
  }
]
EOF
# Set your Datadog site and credentials
export DD_SITE="ap2.datadoghq.com"
export DD_API_KEY="<DD_API_KEY>"

curl -X POST "https://http-intake.logs.${DD_SITE}/api/v2/cilogs" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-d @- << EOF
[
  {
    "message": "Starting tests",
    "pipeline_unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a",
    "job_id": "job-456",
    "line_number": 1,
    "status": "notice",
    "section_name": "tests"
  },
  {
    "message": "Tests passed",
    "pipeline_unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a",
    "job_id": "job-456",
    "line_number": 2
  }
]
EOF
# Set your Datadog site and credentials
export DD_SITE="uk1.datadoghq.com"
export DD_API_KEY="<DD_API_KEY>"

curl -X POST "https://http-intake.logs.${DD_SITE}/api/v2/cilogs" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-d @- << EOF
[
  {
    "message": "Starting tests",
    "pipeline_unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a",
    "job_id": "job-456",
    "line_number": 1,
    "status": "notice",
    "section_name": "tests"
  },
  {
    "message": "Tests passed",
    "pipeline_unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a",
    "job_id": "job-456",
    "line_number": 2
  }
]
EOF
Send one CI job log returns "Request accepted for processing" response
# Set your Datadog site and credentials
export DD_SITE="datadoghq.com"
export DD_API_KEY="<DD_API_KEY>"

curl -X POST "https://http-intake.logs.${DD_SITE}/api/v2/cilogs" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-d @- << EOF
[
  {
    "message": "Running go test ./...",
    "pipeline_unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a",
    "job_id": "job-456",
    "provider_name": "example-provider",
    "line_number": 1,
    "status": "warn",
    "section_name": "tests",
    "ddtags": "runner:linux,architecture:amd64"
  }
]
EOF
# Set your Datadog site and credentials
export DD_SITE="us3.datadoghq.com"
export DD_API_KEY="<DD_API_KEY>"

curl -X POST "https://http-intake.logs.${DD_SITE}/api/v2/cilogs" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-d @- << EOF
[
  {
    "message": "Running go test ./...",
    "pipeline_unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a",
    "job_id": "job-456",
    "provider_name": "example-provider",
    "line_number": 1,
    "status": "warn",
    "section_name": "tests",
    "ddtags": "runner:linux,architecture:amd64"
  }
]
EOF
# Set your Datadog site and credentials
export DD_SITE="us5.datadoghq.com"
export DD_API_KEY="<DD_API_KEY>"

curl -X POST "https://http-intake.logs.${DD_SITE}/api/v2/cilogs" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-d @- << EOF
[
  {
    "message": "Running go test ./...",
    "pipeline_unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a",
    "job_id": "job-456",
    "provider_name": "example-provider",
    "line_number": 1,
    "status": "warn",
    "section_name": "tests",
    "ddtags": "runner:linux,architecture:amd64"
  }
]
EOF
# Set your Datadog site and credentials
export DD_SITE="datadoghq.eu"
export DD_API_KEY="<DD_API_KEY>"

curl -X POST "https://http-intake.logs.${DD_SITE}/api/v2/cilogs" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-d @- << EOF
[
  {
    "message": "Running go test ./...",
    "pipeline_unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a",
    "job_id": "job-456",
    "provider_name": "example-provider",
    "line_number": 1,
    "status": "warn",
    "section_name": "tests",
    "ddtags": "runner:linux,architecture:amd64"
  }
]
EOF
# Set your Datadog site and credentials
export DD_SITE="ap1.datadoghq.com"
export DD_API_KEY="<DD_API_KEY>"

curl -X POST "https://http-intake.logs.${DD_SITE}/api/v2/cilogs" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-d @- << EOF
[
  {
    "message": "Running go test ./...",
    "pipeline_unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a",
    "job_id": "job-456",
    "provider_name": "example-provider",
    "line_number": 1,
    "status": "warn",
    "section_name": "tests",
    "ddtags": "runner:linux,architecture:amd64"
  }
]
EOF
# Set your Datadog site and credentials
export DD_SITE="ap2.datadoghq.com"
export DD_API_KEY="<DD_API_KEY>"

curl -X POST "https://http-intake.logs.${DD_SITE}/api/v2/cilogs" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-d @- << EOF
[
  {
    "message": "Running go test ./...",
    "pipeline_unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a",
    "job_id": "job-456",
    "provider_name": "example-provider",
    "line_number": 1,
    "status": "warn",
    "section_name": "tests",
    "ddtags": "runner:linux,architecture:amd64"
  }
]
EOF
# Set your Datadog site and credentials
export DD_SITE="uk1.datadoghq.com"
export DD_API_KEY="<DD_API_KEY>"

curl -X POST "https://http-intake.logs.${DD_SITE}/api/v2/cilogs" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-d @- << EOF
[
  {
    "message": "Running go test ./...",
    "pipeline_unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a",
    "job_id": "job-456",
    "provider_name": "example-provider",
    "line_number": 1,
    "status": "warn",
    "section_name": "tests",
    "ddtags": "runner:linux,architecture:amd64"
  }
]
EOF