If you are running docker or some other container system where logs are written to stdout you should utilize whatever tooling exists to capture that output (docker logs or similar solutions).
If you are using a zip file installation or some other installation method which writes log files, you can export the system logs using this API call.