Hi all,
I got some weird error when using add_process_metadata in filebeat 7.10.2. It doesn't seem to like integer value.
Given following json input:
{ "level": "info", "pid": 1, "message": "test1", "tags": ["tag1", "tag2"] }
and filebeat config:
logging.level: debug
filebeat.config:
modules:
path: ${path.config}/modules.d/*.yml
filebeat.inputs:
- type: log
paths:
- /tmp/test.log
json.keys_under_root: false
processors:
- add_process_metadata:
match_pids:
- json.pid
ignore_missing: false
output.console:
pretty: true
I expected it to grab process information for pid 1. But filebeat actually threw following error:
2021-02-05T11:51:57.708Z DEBUG [processors] processing/processors.go:128 Fail to apply processor client{add_process_metadata=[match_pids=[json.pid process.ppid process.parent.pid process.parent.ppid], mappings={"container.id":"container.id","process.args":"process.args","process.executable":"process.executable","process.name":"process.name","process.pid":"process.pid","process.ppid":"process.ppid","process.start_time":"process.start_time","process.title":"process.title"}, ignore_missing=false, overwrite_fields=false, restricted_fields=false, host_path=/, cgroup_prefixes=[/kubepods /docker]]}: error applying add_process_metadata processor: cannot parse field 'json.pid' (not an integer or string)
2021-02-05T11:51:57.710Z DEBUG [processors] processing/processors.go:203
If I add a convert processor to convert json.pid to string and then looks up by the new field, it actually works....
- convert:
fields:
- {from: "json.pid", to: "pr.pid", type: "string"}
Not sure whether this is a bug.
Thanks