# I write logs into a file

**URL:** <https://discuss.elastic.co/t/i-write-logs-into-a-file/129861>\
**Category:** Logstash\
**Created:** [April 27, 2018, 4:10pm UTC](https://discuss.elastic.co/t/i-write-logs-into-a-file/129861 "2018-04-27T16:10:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Giorgio\_Cerruti](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/giorgio_cerruti/32/24014_2.png) [@Giorgio\_Cerruti](https://discuss.elastic.co/u/Giorgio_Cerruti)\
**Post date:** [April 27, 2018, 4:10pm UTC](https://discuss.elastic.co/t/i-write-logs-into-a-file/129861/1 "2018-04-27T16:10:29Z")

</div>

Hello,  
I've tried a lot of configurations but I'm not able to allow logstash to log onto a file. I'm using this log4j configuration

```
status = error
name = LogstashPropertiesConfig

appender.console.type = Console
appender.console.name = plain_console
appender.console.layout.type = PatternLayout
appender.console.layout.pattern = [%d{ISO8601}][%-5p][%-25c] %m%n

appender.json_console.type = Console
appender.json_console.name = json_console
appender.json_console.layout.type = JSONLayout
appender.json_console.layout.compact = true
appender.json_console.layout.eventEol = true

appender.rolling.type = RollingFile
appender.rolling.name = rolling
appender.rolling.fileName = logstash.log
appender.rolling.layout.type = PatternLayout
appender.rolling.layout.pattern = [%d{ISO8601}][%-5p][%-25c{1.}] %marker%.10000m%n
appender.rolling.filePattern = logstash-%d{yyyy-MM-dd}.log
appender.rolling.policies.type = Policies
appender.rolling.policies.time.type = TimeBasedTriggeringPolicy
appender.rolling.policies.time.interval = 1
appender.rolling.policies.time.modulate = true

rootLogger.level = ${sys:ls.log.level}
rootLogger.appenderRef.console.ref = ${sys:ls.log.format}_console
rootLogger.appenderRef.rolling.ref = rolling

```

with this logstash configuration

```
---
## Default Logstash configuration from logstash-docker.
## from https://github.com/elastic/logstash-docker/blob/master/build/logstash/config/logstash-oss.yml
#
http.host: "0.0.0.0"
http.port: 9600
path.config: /usr/share/logstash/pipeline
#The directory where Logstash will write its log to.
path.logs: /usr/share/logstash/logs

# The log level. Valid options are: (fatal, error, warn, info, debug and info)
log.level: info

#When set to true, periodically checks if the configuration has changed and reloads the configuration whenever it is changed. This can also be triggered manually through the SIGHUP signal.
config.reload.automatic: true

#How often in seconds Logstash checks the config files for changes.
config.reload.interval: 3

```

and this docker image version

```
docker.elastic.co/logstash/logstash-oss:6.1.3

```

Now, I want to log log messages of logstash to a file but every attempt failed. What am I doing wrong?

Thanks in andvance.

---

<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:** [May 25, 2018, 4:10pm UTC](https://discuss.elastic.co/t/i-write-logs-into-a-file/129861/2 "2018-05-25T16:10:31Z")

</div>

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