Regarding reading value of field variable in filebeat


(vivek) #1

I want to read a variable from a config file and assign it to filed variablet. Please suggest how can we do this.


(vivek) #2

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.


(Magnus Bäck) #3

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?


(vivek) #4

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.


(Magnus Bäck) #5

Filebeat already adds the hostname for you, see https://www.elastic.co/guide/en/beats/filebeat/current/exported-fields.html.


(vivek) #6

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.


(Sai Theodore) #7

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.


(Magnus Bäck) #8

@Sai_Theodore, please start a new thread for your unrelated question.


(system) #9