Timestamp schema for OpenTelemetry Logs to Telegraf

I’m using OpenTelemetry in Rust to write log messages to Telegraf 1.34.1 over gRPC. Log messages:

[...]
logs,host=m1,service.name=testapp body="The state of asset number 0 has been updated.",attributes="{\"ask\":\"NaN\",\"asset_no\":\"0\",\"bid\":\"NaN\",\"mid\":\"NaN\",\"state_values\":\"StateValues { position: 0.0, balance: 0.0, fee: 0.0, num_trades: 0, trading_volume: 0.0, trading_value: 0.0 }\",\"telemetry.sdk.language\":\"rust\",\"telemetry.sdk.name\":\"opentelemetry\",\"telemetry.sdk.version\":\"0.29.0\"}",observed_time_unix_nano=1743928329100297000i,severity_number=9i,severity_text="INFO" 0
2025-04-06T08:32:10Z D! [outputs.file] Wrote batch of 10 metrics in 314.165µs
2025-04-06T08:32:10Z D! [outputs.file] Buffer fullness: 0 / 10000 metrics
2025-04-06T08:32:10Z E! [outputs.influxdb_v2] When writing to [https://influxdb/api/v2/write]: failed to write metric to telegraf (will be dropped: 422 Unprocessable Entity): unprocessable entity: failure writing points to database: partial write: points beyond retention policy dropped=10

The writing to InfluxDB fails with above error. I assume the problem is the timestamp observed_time_unix_nano. The influxdb-observability/docs/logs.md at main · influxdata/influxdb-observability · GitHub docs mention that the log records field “OpenTelemetry LogRecord field” is named time_unix_nano. How can I map observed_time_unix_nano to time_unix_nano or Influx name timestamp ?

@vxmd Welcome to Influxdata Community!

You can use the rename processor to rename the field. Here’s an example configuration:

[[processors.rename]]
  [[processors.rename.replace]]
    field = "observed_time_unix_nano"
    dest  = "time_unix_nano"

For more details, refer to the official documentation:
:backhand_index_pointing_right: Telegraf Rename Processor

1 Like