Logstash not outputting to file

Hello everyone, im triying to set up to logstash outputs one that will output to elastic (which runs fine) and one that would simply output to a json file on file storage, i have attempted to different configs

Config 1:
input {

beats {

port => 5044

}
}

output {

elasticsearch {

      hosts => "http://localhost:9200"

      index => "%{[@metadata][beat]}-%{[@metadata][version]}-%{+YYYY.MM.dd}"

}
file {

path => "/var/logstash/%{host}/%{facility}-%{+YYYY-MM-dd}.log"

}

}

Config 2:
input {

beats {

port => 5044

}
}

output {

elasticsearch {

 hosts => "http://localhost:9200"

 index => "%{[@metadata][beat]}-%{[@metadata][version]}-%{+YYYY.MM.dd}"

}
file {

  message_format => "%{[time]} | %{[severity]} : /%{[thread]}/ %{[loggername]} (% 
  {[sourcemethodname]}) - %{[message]}"
 path => "/var/logstash/%{host}/%{facility}-%{+YYYY-MM-dd}.log"

}

}

Config 1 allows filebeat to connect to logstash and outputs fine in elasticsearch, but does not output to file (for testing purposes i placed chmod 777 to var log stash just to confirm it is not a permissions issue)

Config 2 denies connection to logstash

Any help would be appreciated, or advise if i can follow that is happening in logstash live.

There is no message_format option for the file input, so this will get a compilation error for the configuration and the pipeline will not start.

You could try using the line codec on the file output with a format option.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.