Skip to content

Latest commit

 

History

History
220 lines (169 loc) · 8.52 KB

settings-api.md

File metadata and controls

220 lines (169 loc) · 8.52 KB

Settings

The Dynatrace Settings API provides a unified way to manage configuration objects across the platform. It is the primary mechanism for configuring OpenPipeline, built-in settings, and many other Dynatrace features. Direct OpenPipeline commands have been removed; all OpenPipeline configuration goes through this Settings API using builtin:openpipeline.* schemas.

dtctl docs / Resources / Settings

Supported operations

Operation Resource Command syntax Description Mutating Access
create settings dtctl create settings Create resources from files yes write
delete settings dtctl delete settings Delete resources yes delete
describe settings dtctl describe settings Show details of a specific resource no read
edit settings dtctl edit settings Edit a resource yes write
get settings dtctl get settings Display one or many resources no read
describe settings-schema dtctl describe settings-schema Show details of a specific resource no read
get settings-schemas dtctl get settings-schemas Display one or many resources no read

Flags

These commands take dtctl's global flags (-o/--output, --context, --jq, -v, and more). Some verbs add their own flags (apply, diff, query, inventory); see the verb in COMMANDS.md. Individual commands may take further flags of their own — run dtctl <verb> <resource> --help for the authoritative list.

Required token scopes

Safety level Scopes
read app-settings:objects:read, settings:objects:read, settings:schemas:read
write settings:objects:write

Output

get settings returns an array of settings objects for the given schema; each includes an object ID and a version identifier used for optimistic locking on update. -o yaml/-o json are the practical formats here since objects are usually round-tripped through export/edit/apply. describe settings-schema shows a schema's fields and constraints.

Examples

Discover schemas, then inspect one:

# List all settings schemas
dtctl get settings-schemas

# Get a specific schema by its ID (positional)
dtctl get settings-schemas builtin:openpipeline.logs.pipelines

# Describe a specific schema to see its fields and constraints
dtctl describe settings-schema builtin:openpipeline.logs.pipelines

List objects for a schema:

dtctl get settings --schema builtin:openpipeline.logs.pipelines --scope environment
dtctl get settings --schema builtin:openpipeline.logs.pipelines --scope environment -o json

Create a settings object from a YAML file:

# Create
dtctl create settings -f pipeline.yaml --schema builtin:openpipeline.logs.pipelines --scope environment

# Preview changes without applying
dtctl create settings -f pipeline.yaml --schema builtin:openpipeline.logs.pipelines --scope environment --dry-run

# Template variables for environment-specific values
dtctl create settings -f pipeline.yaml --schema builtin:openpipeline.logs.pipelines --scope environment \
  --set env=production --set retention=90

Update via export/edit/apply. The version is handled automatically when the file was retrieved via dtctl get:

dtctl get settings --schema builtin:openpipeline.logs.pipelines --scope environment -o yaml > pipeline.yaml
# edit pipeline.yaml
dtctl apply -f pipeline.yaml

Bulk update: the array returned by get can be edited and applied back directly. Each item is applied individually, so if some fail the rest still succeed and a summary error reports the failures:

dtctl get settings --schema builtin:rum.web.enablement -o yaml > rum-settings.yaml
# edit rum-settings.yaml
dtctl apply -f rum-settings.yaml

Delete a settings object by its object ID:

dtctl delete settings <object-id>

Deploy the same settings configuration across environments with template variables:

dtctl create settings -f pipeline-template.yaml \
  --schema builtin:openpipeline.logs.pipelines --scope environment \
  --set env=staging

dtctl ctx use production
dtctl create settings -f pipeline-template.yaml \
  --schema builtin:openpipeline.logs.pipelines --scope environment \
  --set env=production

Notes

Concepts

Settings objects use optimistic locking to prevent conflicting updates. When you retrieve an object, it includes a version identifier that you must provide when updating it.

Objects owned by other users

Some schemas, OpenPipeline pipelines among them, control access per object: a settings object belongs to the user who created it, and others see and change it only if it was shared with them. So dtctl get settings --schema ... lists only the objects you own or were shared, whatever dtctl's safety level. An administrator can pass --admin-access to act as the owner of every object. It works with get, describe, edit and delete settings, and with apply for a settings object:

dtctl get settings --schema builtin:openpipeline.logs.pipelines --admin-access
dtctl apply -f pipeline.yaml --admin-access

The token needs the settings:objects:admin scope, and the tenant's IAM policy needs the settings:objects:admin permission. dtctl auth login requests the scope at the readwrite-all and dangerously-unrestricted safety levels; log in again if your session predates it.

Schemas and scopes

Common OpenPipeline schemas:

Schema ID Purpose
builtin:openpipeline.logs.pipelines Log processing pipelines
builtin:openpipeline.logs.ingest-sources Log ingest source configuration
builtin:openpipeline.logs.routing Log routing rules
builtin:openpipeline.logs.security-context Security context for log pipelines
builtin:openpipeline.events.pipelines Event processing pipelines
builtin:openpipeline.events.sdlc SDLC event pipelines
builtin:openpipeline.business-events.pipelines Business event pipelines

Advanced usage

Example pipeline YAML for a log processing pipeline settings object:

customId: my-log-pipeline
displayName: Production Log Pipeline
processing:
  - name: extract-severity
    description: Extract severity from log message
    processor:
      type: dql
      dqlScript: |
        parse content, "LD 'severity=' WORD:severity"
  - name: normalize-timestamp
    description: Normalize timestamp format
    processor:
      type: dql
      dqlScript: |
        fieldsAdd timestamp = toTimestamp(raw_timestamp)
storage:
  catch_all:
    bucketName: default_logs
    enabled: true
  custom:
    - bucketName: logs-production
      enabled: true
      matcher: severity == "ERROR" or severity == "CRITICAL"
routing:
  catch_all:
    pipelineId: default
    enabled: true

Typical workflow for configuring OpenPipeline through the Settings API:

  1. Discover schemas: list available OpenPipeline schemas to find the one you need.
    dtctl get settings-schemas
  2. Inspect the schema: understand its required fields and constraints.
    dtctl describe settings-schema builtin:openpipeline.logs.pipelines
  3. Check existing configuration: see what is already configured.
    dtctl get settings --schema builtin:openpipeline.logs.pipelines --scope environment -o yaml
  4. Prepare your YAML: write the settings object definition.
  5. Dry-run: validate your configuration before applying it.
    dtctl create settings -f pipeline.yaml --schema builtin:openpipeline.logs.pipelines --scope environment --dry-run
  6. Apply: create or update the settings object.
    dtctl create settings -f pipeline.yaml --schema builtin:openpipeline.logs.pipelines --scope environment
  7. Verify: confirm the settings were applied.
    dtctl get settings --schema builtin:openpipeline.logs.pipelines --scope environment

Template file used for the multi-environment deployment example:

# pipeline-template.yaml
customId: "{{ .env }}-log-pipeline"
displayName: "{{ .env | title }} Log Pipeline"
storage:
  catch_all:
    bucketName: "logs-{{ .env }}"
    enabled: true
  custom:
    - bucketName: "logs-{{ .env }}-errors"
      enabled: true
      matcher: severity == "ERROR"