Am running filebeat within my cluster but I can't figure out how to add fields to my log documents which would include the pod's annotations. That's super relevant for search later.
With that, I do get log events, and they're annotated with some pod metadata, but nothing beyond what I'd get even if I didn't include all that part with the providers.
Can someone point out to me what's the correct way of including my annotations in these events?
As a note, I also double-checked my pods do include the labels I use in the config.
Then this is what I did... even if the pod include_annotations worked for pods (which it looks like it only works for node or namespace it does not work with wild cards so you would have to name each annotation you would want anyways... so instead I just added them as fields ...
here is my example
data:
filebeat.yml: |-
# To enable hints based autodiscover, remove `filebeat.inputs` configuration and uncomment this:
filebeat.autodiscover:
providers:
- type: kubernetes
node: ${NODE_NAME}
hints.enabled: true
hints.default_config:
type: container
paths:
- /var/log/containers/*${data.kubernetes.container.id}.log
# Set Fields
fields_under_root: true
fields:
# You can see the whole kubernetes object...
fields.test: "test"
# Set Fields
fields_under_root: true
fields:
# You can see the whole kubernetes object...
fields.test: "test"
fields.annotations.co.elastic.monitor/type: "${data.kubernetes.annotations.co.elastic.monitor/type}"
fields.annotations.co.elastic.monitor/schedule: "${data.kubernetes.annotations.co.elastic.monitor/schedule}"
fields.annotations.co.elastic.monitor/timeout: "${data.kubernetes.annotations.co.elastic.monitor/timeout}"
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.