Versions (relevant - OpenSearch/Dashboard/Server OS/Browser):
opensearch node - version 1.3.7
Describe the issue:
we are running opensearch in docker. version is 1.3.7. I have observed that opensearch logs for docker is only present in docker console and not on filesystem.
Is there a way what is getting printed on docker console the same can be present in opensearch log folder as well ?
Configuration:
Relevant Logs or Screenshots:
I think the way to go is with a custom log4j.properties
file. You make that do whatever you want (e.g. what it does on a stand-alone installation), then use a volume to mount your custom log4.properties
into /usr/share/opensearch/config/log4j2.properties
.
thanks. I have already tried this before posting this question. This is updating the console log and on filesystem it only logs as per mentioned in docs. " On Docker, OpenSearch writes most logs to the console and stores the remainder in opensearch/logs/
"
Strange, because I remember it working for me. I had something like this in my docker-compose file:
volumes:
- './log4j2.properties:/usr/share/opensearch/config/log4j2.properties'
I made it log in JSON with this log4j config:
appender.console.type = Console
appender.console.name = console
appender.console.layout.type = OpenSearchJsonLayout
appender.console.layout.type_name = json_logger
rootLogger.level = info
rootLogger.appenderRef.console.ref = console
But I didn’t try making it log to a file. How does your log4j config look like?
Hi, thanks for reply. first of all sorry for being little late in reply , got stuck in multiple urgent issues.
I have tried multiple log4j2 options, but none of them worked, so I didnt save anything,
I have tried the one which you shared. but that also doesnt work. means it doesnt log anything on filesystem . I can see following files
ls -ltr logs/
-rw-rw-r-- 1 kandarp kandarp 1321 Sep 25 09:45 gc.log.00
-rw-rw-r-- 1 kandarp kandarp 94943 Sep 25 09:51 performance-analyzer.log
-rw-rw-r-- 1 kandarp kandarp 281783 Sep 25 09:51 gc.log
Aha, those files are not really from log4j. But maybe you can share your last attempt config?