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

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.