Hi all, I’m trying to take values from an incomin...
# fluent-bit
p
Hi all, I’m trying to take values from an incoming JSON payload and insert them into the OTEL log record attributes dynamically. For example, if my incoming JSON has:
Copy code
{
  "user": "postgres",
  "env": "production",
  "event": "connection_start"
}
I want to transform it into a valid OTEL log format like this:
Copy code
{
  "resourceLogs": [
    {
      "scopeLogs": [
        {
          "logRecords": [
            {
              "timeUnixNano": "1666799656123456789",
              "body": {
                "stringValue": "connection_start"
              },
              "attributes": [
                {
                  "key": "user",
                  "value": {
                    "stringValue": "postgres"
                  }
                },
                {
                  "key": "env",
                  "value": {
                    "stringValue": "production"
                  }
                },
                {
                  "key": "event",
                  "value": {
                    "stringValue": "connection_start"
                  }
                }
              ]
            }
          ]
        }
      ]
    }
  ]
}
Basically, I need to parse the original JSON and map those key/value pairs into the attributes array of the OTEL log record. Is this possible using Content Modifier? Can we solve this? How can we dynamically add the data into Content Modifier, since it only accepts static data?