MetricBeat - Unable to create dynamic namespace

MetricBeat - Unable to create dynamic namespace.

My project requirement is to create a dynamic namespace(based on hostname).
How do i get access to host name or beat name inside metricbeat.yml

I tried something similar to namespace: "[host][name]" but no luck. Could you guide me how to add dynamic namespace?

I'm not sure if this is going to work out, but you can try with:

namespace: "%{[beat.name]}"

or

namespace: "%{[beat.host]}"

I tried these already but it doesn't pick the beat name.

${path.config} is working for namespace but its useless as it produces path.

I have gone through fields.yml file there are lot of fields like, beat.name, beat.version..... but accessing it under metricbeat.yml for namespace is still not known.
(
Am wondering how it can be accessed under elasticsearch output but why not in namespace?
output.elasticsearch:

hosts: ["localhost:9200"]
index: "metricbeat-%{[beat.version]}-%{+yyyy.MM.dd}"
)
Am confused. :frowning:
Any idea?

You have access to all environment variables, as per https://www.elastic.co/guide/en/beats/metricbeat/current/using-environ-vars.html

You should be able to do:

namespace: ${HOSTNAME}

Best regards

No.It doesn't help. It works under ElasticSearch index name but not under namespace.