# Writing appender.json\_console logs for logstash to file

**URL:** <https://discuss.elastic.co/t/writing-appender-json-console-logs-for-logstash-to-file/244746>\
**Category:** Logstash\
**Tags:** docker\
**Created:** [August 12, 2020, 3:16pm UTC](https://discuss.elastic.co/t/writing-appender-json-console-logs-for-logstash-to-file/244746 "2020-08-12T15:16:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![vishnuanil](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vishnuanil/32/73763_2.png) [@vishnuanil](https://discuss.elastic.co/u/vishnuanil)\
**Post date:** [August 12, 2020, 3:16pm UTC](https://discuss.elastic.co/t/writing-appender-json-console-logs-for-logstash-to-file/244746/1 "2020-08-12T15:16:52Z")

</div>

Currently all appender.json\_console logs are written as stdout and logs are written into a docker container json log for logstash which is using a lot of disk space. I am aware of the options to utilize docker options -log-opts to limit the log size, but would like to see if we have options like below?

Is it possible to utiilse the log4j.properties configuration to write the json\_console log to a file like other logstash log. Trying to achieve something like below.

`appender.json_console.fileName = ${sys:ls.logs}/logstash-${sys:ls.log.format}.log`

**Current configuration portion given below**

```auto
 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 = plain_rolling
appender.rolling.fileName = ${sys:ls.logs}/logstash-${sys:ls.log.format}.log
appender.rolling.filePattern = ${sys:ls.logs}/logstash-${sys:ls.log.format}-%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
appender.rolling.layout.type = PatternLayout
appender.rolling.layout.pattern = [%d{ISO8601}][%-5p][%-25c] %-.10000m%n

appender.json_rolling.type = RollingFile
appender.json_rolling.name = json_rolling
appender.json_rolling.fileName = ${sys:ls.logs}/logstash-${sys:ls.log.format}.log
appender.json_rolling.filePattern = ${sys:ls.logs}/logstash-${sys:ls.log.format}-%d{yyyy-MM-dd}.log
appender.json_rolling.policies.type = Policies
appender.json_rolling.policies.time.type = TimeBasedTriggeringPolicy
appender.json_rolling.policies.time.interval = 1
appender.json_rolling.policies.time.modulate = true
appender.json_rolling.layout.type = JSONLayout
appender.json_rolling.layout.compact = true
appender.json_rolling.layout.eventEol = true

```

---

<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:** [September 9, 2020, 3:17pm UTC](https://discuss.elastic.co/t/writing-appender-json-console-logs-for-logstash-to-file/244746/2 "2020-09-09T15:17:15Z")

</div>

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