For the complete documentation index, see llms.txt. This page is also available as Markdown.

Log Pipelines API

Manage pipeline rules, simulate transformations, and inspect processing statistics.

Authentication and permissions

Use an API key in Authorization: Bearer <YOUR_API_KEY> and select the backend with X-Backend-Id: <YOUR_BACKEND_ID>. Use your own API base URL for a self-hosted deployment.

Admin required: creating, replacing or clearing the pipeline configuration. Reading configuration, simulating rules and querying statistics require backend access but do not require Admin permissions.

Endpoints

Method
Endpoint
Purpose

GET

/api/pipelines/logs/config

Read the current configuration.

POST

/api/pipelines/logs/config

Admin required. Write configuration; returns HTTP 201.

PUT

/api/pipelines/logs/config

Admin required. Replace configuration; returns HTTP 200.

DELETE

/api/pipelines/logs/config

Admin required. Clear the configured rules; returns HTTP 200.

POST

/api/pipelines/logs/simulate

Test rules against a supplied record without saving.

POST

/api/pipelines/logs/stats

Query processing statistics, optionally for a configuration ID.

POST

/api/pipelines/logs/current-stats

Query statistics for the current pipeline.

Read configuration

curl --request GET 'https://api.groundcover.com/api/pipelines/logs/config' \
  --header 'Authorization: Bearer <YOUR_API_KEY>' \
  --header 'X-Backend-Id: <YOUR_BACKEND_ID>'

The response contains uuid, created_by, created_timestamp, and value. value is the saved configuration text as a JSON string. Use jq -r '.value' to decode and display it as shown in Get Logs Pipeline Configuration. If there is no configuration, the endpoint returns HTTP 204 with no body.

Create or replace configuration

Both POST and PUT accept a JSON request body with a required value string. That string contains the pipeline configuration document, which can be YAML or JSON text. Rule names must be nonempty and unique. Unknown configuration fields and invalid OTTL statements are rejected with HTTP 400.

Read and save the current configuration before replacing it. A write replaces the complete rule list; it does not append or merge individual rules. Preserve any existing rules you want to keep.

The file-based examples below require jq. Save this configuration in logs-pipeline.yaml:

This rule adds environment: production to each log's attributes. Adapt it to your environment and include any existing rules you want to keep.

Wrap the file contents in the JSON value field:

jq --rawfile reads the file as a string and handles JSON escaping for you. --data-binary @- sends the generated JSON from standard input. If the file contains JSON configuration text instead of YAML, use the same command with that filename; value is still a string.

Use POST with the same body to write configuration with a 201 response. Successful writes return the same metadata and value structure as GET.

Simulate rules

Simulation does not modify the saved pipeline. Despite its name, ruleYaml accepts the same YAML or JSON configuration text as value. Reuse the logs-pipeline.yaml file above and provide a sample log record:

The response includes ruleValid, ruleRan, logDropped, an optional error, and the resulting logRecord. The input record can include time (RFC3339), source, cluster, env, workload, namespace, container_name, body, trace_id, span_id, level, format, attributes, and tags.

HTTP 200 alone does not mean the rule is valid or executed successfully: inspect ruleValid and error. A condition that does not match can leave ruleRan false.

For this example, a successful simulation preserves payment_id and adds the environment attribute. The returned logRecord.attributes contains:

Query statistics

Field
Type
Required
Description

start

string

Yes

RFC3339 start time.

end

string

Yes

RFC3339 end time, at or after start.

sources

array

No

Structured source filter conditions. Omit for all permitted sources.

configId

string

No

Configuration fingerprint (uuid from GET). Only for /stats.

The response is {"stats": [...]}. Each entry identifies the configuration and rule and includes processed/dropped counts, condition and execution errors, and processing-time measurements. The shared response uses names such as totalLogsSeen and totalLogsDropped, including for trace pipelines.

For the current configuration, send the same time window to /api/pipelines/logs/current-stats without configId. Its response contains both stats and totalStats.

Clear configuration

This clears the dynamic pipeline configuration. It does not delete stored observability data. An unavailable configuration service can return HTTP 503.

Last updated