On This Page

Home / Cribl as Code/ Cribl API/ API Code Examples/Update Configurations

Update Configurations

Use the Cribl API to programmatically update the configuration of supported objects like Sources and Destinations. Use the /system/inputs endpoints for Sources and the /system/outputs endpoints for Destinations (see the API Reference for details).

About Code Examples

Code examples use Bearer token authentication. Read the API authentication documentation to learn how to configure authentication. The API Credential (Cribl.Cloud and hybrid) or login credentials (on-prem) that you use to obtain the Bearer token must have the necessary Permissions for the operations in code examples.

Replace the variables in code examples with the corresponding information for your Cribl deployment.

For on-prem deployments, to use https in request URLs, you must configure Transport Layer Security (TLS).

Code examples do not include all available body parameters. For a complete list of body parameters for specific endpoints, refer to the documentation in the API Reference.

In Cribl.Cloud and other distributed deployments, you must commit and deploy the changes you make.

Update a Destination Configuration

This example demonstrates how to change the secret key pair that is used to authenticate to an existing MinIO Destination by sending a PATCH request to the /system/outputs/{id} endpoint. But first, you’ll send a GET request to retrieve the definition for the Destination. The definition includes the attributes and values you’ll need to include in the body of your PATCH request.

The PATCH /system/outputs/{id} endpoint requires a complete representation of the resource that you want to update in the request body. This endpoint does not support partial updates. Cribl removes any omitted fields when updating the resource.

Also, the body for your PATCH request is based on the existing configuration that you retrieve, so you must confirm that the configuration is correct. If the existing configuration is incorrect, the updated resource may not function as expected.

1. Retrieve the Definition for the Destination

Retrieve the definition for the Destination that you want to update. After you confirm that the retrieved definition is correct, you’ll use it as the basis of your request in the next step, changing only the values that you want to update.

In this example, the Destination ID is MinIO_testing.

Cribl.Cloud and HybridOn-Prem (Single-Instance)On-Prem (Distributed)

The response includes the definition of the MinIO_testing Destination as a JSON object:

{
  "items": [
    {
      "id": "MinIO_testing",
      "systemFields": [
        "cribl_pipe"
      ],
      "streamtags": [],
      "awsAuthenticationMethod": "secret",
      "stagePath": "$CRIBL_HOME/state/outputs/testing",
      "addIdToStagePath": true,
      "signatureVersion": "v4",
      "objectACL": "private",
      "reuseConnections": true,
      "rejectUnauthorized": true,
      "verifyPermissions": true,
      "removeEmptyDirs": true,
      "partitionExpr": "C.Time.strftime(_time ? _time : Date.now()/1000, '%Y/%m/%d')",
      "format": "json",
      "baseFileName": "`CriblOut`",
      "fileNameSuffix": "`.${C.env[\"CRIBL_WORKER_ID\"]}.${__format}${__compression === \"gzip\" ? \".gz\" : \"\"}`",
      "maxFileSizeMB": 32,
      "maxOpenFiles": 100,
      "headerLine": "",
      "writeHighWaterMark": 64,
      "onBackpressure": "block",
      "deadletterEnabled": false,
      "onDiskFullBackpressure": "block",
      "maxFileOpenTimeSec": 300,
      "maxFileIdleTimeSec": 30,
      "maxConcurrentFileParts": 4,
      "compress": "gzip",
      "compressionLevel": "best_speed",
      "emptyDirCleanupSec": 300,
      "type": "minio",
      "endpoint": "http://minio:9090",
      "bucket": "test",
      "awsSecret": "MinIO_testing_minio_secret_keypair",
      "status": {
        "health": "Green",
        "timestamp": 1742219848827,
        "metrics": {
          "openFileStreams": 0,
          "sentCount": 0,
          "bytesWritten": 0
        }
      },
      "notifications": []
    }
  ],
  "count": 1
}

2. Update the Destination Configuration

Use the response to the GET /system/outputs/{id} request from the previous step as the request body, with the following changes:

  • Do not include the items array or the count attribute from the GET response.
  • Replace the value for the awsSecret parameter with the name of the secret key pair that you want to use for the Destination.

Do not omit any fields from the resource representation in the request body. Include a complete representation of the resource, replacing only the values for the fields that you want to update. Cribl removes any omitted fields when updating the resource.

Cribl.Cloud and HybridOn-Prem (Single-Instance)On-Prem (Distributed)

The response includes the definition of the MinIO_testing Destination with the updated awsSecret value:

{
  "items": [
    {
      "id": "MinIO_testing",
      "systemFields": [
        "cribl_pipe"
      ],
      "streamtags": [],
      "awsAuthenticationMethod": "secret",
      "stagePath": "$CRIBL_HOME/state/outputs/testing",
      "addIdToStagePath": true,
      "signatureVersion": "v4",
      "objectACL": "private",
      "reuseConnections": true,
      "rejectUnauthorized": true,
      "verifyPermissions": true,
      "removeEmptyDirs": true,
      "partitionExpr": "C.Time.strftime(_time ? _time : Date.now()/1000, '%Y/%m/%d')",
      "format": "json",
      "baseFileName": "`CriblOut`",
      "fileNameSuffix": "`.${C.env[\"CRIBL_WORKER_ID\"]}.${__format}${__compression === \"gzip\" ? \".gz\" : \"\"}`",
      "maxFileSizeMB": 32,
      "maxOpenFiles": 100,
      "headerLine": "",
      "writeHighWaterMark": 64,
      "onBackpressure": "block",
      "deadletterEnabled": false,
      "onDiskFullBackpressure": "block",
      "maxFileOpenTimeSec": 300,
      "maxFileIdleTimeSec": 30,
      "maxConcurrentFileParts": 4,
      "compress": "gzip",
      "compressionLevel": "best_speed",
      "emptyDirCleanupSec": 300,
      "type": "minio",
      "endpoint": "http://minio:9090",
      "bucket": "test",
      "awsSecret": "MinIO_new_minio_secret_keypair",
      "notifications": [],
      "status": {
        "health": "Green",
        "timestamp": 1742223031723,
        "metrics": {
          "openFileStreams": 0,
          "sentCount": 0,
          "bytesWritten": 0
        }
      }
    }
  ],
  "count": 1
}