# Logstash not outputting to file

**URL:** <https://discuss.elastic.co/t/logstash-not-outputting-to-file/191809>\
**Category:** Logstash\
**Created:** [July 23, 2019, 12:29pm UTC](https://discuss.elastic.co/t/logstash-not-outputting-to-file/191809 "2019-07-23T12:29:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![a.gavric](https://avatars.discourse-cdn.com/v4/letter/a/73ab20/32.png) [@a.gavric](https://discuss.elastic.co/u/a.gavric)\
**Post date:** [July 23, 2019, 12:29pm UTC](https://discuss.elastic.co/t/logstash-not-outputting-to-file/191809/1 "2019-07-23T12:29:10Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [July 23, 2019, 1:43pm UTC](https://discuss.elastic.co/t/logstash-not-outputting-to-file/191809/2 "2019-07-23T13:43:45Z")

</div>

> [@a.gavric](#):
>
> Config 2 denies connection to logstash

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](https://www.elastic.co/guide/en/logstash/current/plugins-codecs-line.html#plugins-codecs-line-format) option.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [August 20, 2019, 1:43pm UTC](https://discuss.elastic.co/t/logstash-not-outputting-to-file/191809/3 "2019-08-20T13:43:49Z")

</div>

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