I am reading a message log from the tail input and parsing it. So far I was able to add several records from environment variables using Record Modifier.
Now I need to read values from two files with format
# /etc/podinfo/annotations
key.name1="value1"
key.name2="value2"
# /etc/podinfo/labels
key.name3="value3"
key.name4="value3"
and add those values to each log line as annotations.key.name1
, annotations.key.name2
, labels.key.name3
and labels.key.name4
respectively.
The issue is that I don't know the content of the files, or the number of values until the container is started. They will however be static, so once the container is up and running, I don't expect those files to change.
And yes, the environment is in kubernetes, but it's a dedicated sidecar to one of the applications, so it's not an entire Kubernetes monitoring, just that specific pod.
So the question is: How can I read fields from those files and attach them to each log tailed?