Logstash 8.9.0 docker logs to stdout. how to provide custom path for it?

What is the file and path that needs to changed to provide custom log path for logstash-plain.log and so on.
Please advise

logstash logs using log4j2. /etc/logstash/log4j2.properties controls the paths using entries such as

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}-%i.log.gz

I believe that references this entry from /etc/logstash/logstash.yml

path.logs: /var/log/logstash

So to move logs to another directory you can edit logstash.yml, to change the file name you edit log4j2.properties.

If you need to capture stdout when running as a service that would depend on the configuration of the service manager.

Thank you @Badger.

I run logstash from command line using /usr/share/logstash/bin/logstash -f /usr/share/logstash/conf.d/ -w 2

I see stdout logs of the container.

logstash.yml the path is /usr/share/logstash/config/logstash.yml


bash-4.4$ cat /usr/share/logstash/config/logstash.yml 

path.logs: /usr/share/logstash/

Any help here @Badger. Sorry for a confusion. I don't need custom path. Docker stdout's the log, I need it to push the logs to /usr/share/logstash/logs

@Badger Any help here.
This is the latest

 /usr/share/logstash/bin/logstash --path.settings=/usr/share/logstash/config -f /usr/share/logstash/conf.d/ 
Sending Logstash logs to /usr/share/logstash/logs1 which is now configured via log4j2.properties

bash-4.4$ ls -ld /usr/share/logstash/logs1
drwxrwxrwx 2 logstash logstash 6 Sep 12 19:00 /usr/share/logstash/logs1
  logstash.yml: |
    path.logs: /usr/share/logstash/logs1
    log.format: plain

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