Added two metadata fields under 'host' to our index template and preloaded this into our elastic cluster like this:
"metadata": {
"properties": {
"id1": {
"type": "long"
},
"id2": {
"type": "long"
}
}
},
Hoped we could define these values when launching the winlogbeat service by adding -E metadata.idX=valX arguments (X=1|2) and then in the YML file do this:
processors:
- add_cloud_metadata: ~
- add_docker_metadata: ~
- add_host_metadata:
netinfo.enabled: true
- add_fields:
target: host.metadata
fields:
id1: ${metadata.id1?You need to set the metadata.id1 environment variable}
id2: ${metadata.id2?You need to set the metadata.id2 environment variable}
But we get this error when attempting to launch service:
2019-12-09T10:50:11.266+0100 ERROR instance/beat.go:916 Exiting: error initializing processors: fail to unpack the add_fields configuration: missing field accessing 'processors.3.add_fields.fields.assetid' (source:'C:\Program Files\WinlogBeat\winlogbeat.yml')
Why?
Seems what failed was the env.var expansion: