AutoMerge is generally available

Last updated:

Copy Attributes

Copy the value of an attribute or OTLP field into another attribute with a Copy step in a transform rule.

A Copy step writes the value of an attribute or OTLP field into another attribute or field, and keeps the source. Use it to make a value available under a second key, for example to put the resource's service.name on every span, or the log body into an attribute.

Copy step that copies the resource attribute service.name into the span attribute service, and the OTTL it writes

Add a Copy Step

  1. In the rule editor, click + Transformation and set Transformation to Copy. Or hover the attribute in Input sample data, click Add a transformation step, and pick Copy. That fills in the source for you.
  2. Fill in the fields:
  • Source context: Where the value is: Resource, Scope, or the record, such as Span or Log record.
  • Source attribute: The attribute or field to copy, for example service.name or otel.log.body.
  • Target context: Where to write the copy.
  • Target attribute: The attribute or field to write. It must differ from the source.
  1. Check the Output panel: the target shows as added, or as modified with its previous value.

Example

Copying the log body into the message attribute writes this OpenTelemetry Transformation Language (OTTL) statement:

text
set(attributes["message"], log.body)

Limits

  • Overwrites the target: If the target already has a value, the copy replaces it.
  • Readable source, writable target: The source may be read-only, but not protected. The target may be neither.

Further Reading