I want to read a variable from a config file and assign it to filed variablet. Please suggest how can we do this.
Sorry i think there was a typo. To make it clear how can i read the value of a variable in config file and assign it to filebeat filed and then output to logstash.
And by variable you mean environment variable? I'm pretty sure that's not possible out of the box. What are you trying to accomplish, i.e. what problem is solved by being able to read an environment variable?
I'm trying to get the server name from where the logs are forwarded to ELK . Instead of hard coding the name of each server as a field in the filebeat.yml file i'm trying to read it from some config file and pass it on to logstash. Please suggest if there is any alternative for this if it cannot be read from enviornment variable.
Filebeat already adds the hostname for you, see https://www.elastic.co/guide/en/beats/filebeat/current/exported-fields.html.
Thanks for the information. Currently i've copied filebeat in to a chassis and forwarding the same. Let me check if i the chassis name will send to logstash using filebeat.
Though Filebeat send the hostname under the beat properties, I would like to send the hostname in a custom field. Is there a way to do this? This is required because the output is sent to kafka and the consumer expects the message in a specific format.