Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Datadog: Remap a field from an array inside an attribute

Tags:

grok

datadog

The log has come into datadog as a JSON object and attributes have been parsed automatically.

Next I want to extract the owner field from an array nested in the JSON:

This syntax doesn't work does in datadog: @detail.resources[0].tags.owner

{
  name: "example_name"
  detail: { 
    resources: [
     /*0*/ { tags: {owner: "[email protected]"}}, 
     /*1*/ { tags: {owner: "[email protected]"}}
    ]
}

This syntax doesn't work does in datadog: @detail.resources[0].tags.owner

each value in the array should have the same owner. How can I use datadog processors to remap the first found email from this array to another attribute called @application.owner? Do I have to unparse the JSON somehow and use a Grok Processor?

like image 582
Josh Sharkey Avatar asked Feb 06 '26 07:02

Josh Sharkey


1 Answers

I had the same issue. What has worked for me at the end is using a Remapper, for example:

Set attribute(s) or tag key to remap: detail.resources.0.tags.owner

Set target attribute or tag key: application.owner

like image 70
Vladimir Avatar answered Feb 09 '26 11:02

Vladimir



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!