Values

Learn about the Values OTTL converter function.

The Values converter extracts all values from a map and returns them as a list.

Syntax: Values(map)

  • map: the map field to extract values from

Input

{
	"_type": "log",
	"body": "Configuration loaded",
	"resource": {...},
	"attributes": {
		"config": {
			"timeout": 30,
			"retries": 3,
			"batch_size": 100,
			"enabled": true
		}
	}
}

Statement

set(attributes["config_values"], Values(attributes["config"]))

Output

{
	"_type": "log",
	"body": "Configuration loaded",
	"resource": {...},
	"attributes": {
		"config": {
			"timeout": 30,
			"retries": 3,
			"batch_size": 100,
			"enabled": true
		},
		"config_values": [30, 3, 100, true]
	}
}

The Values function extracted all values from the config map.