I know the way by checking /var/lib/docker/containers/<containerid>-json.log from the host(including mapping this volume), and through docker client API, but is there any other way viewing log from inside a container?
If your image runs a non-interactive process such as a web server or a database, that application may send its output to log files instead of STDOUT and STDERR.
*** If you use a logging driver which sends logs to a file, an external host, a database, or another logging back-end you may not see the logs.
Related
I am running a docker window container which is running a window service . It is trying to load a file from On-Premise file server. I have tried to map the file server path inside container using "net use" command with different credentials who have access to the file server path. After that I have used "CMDKEY" commands to authenticate the file server. I am able to do that but while application is running it is not able to access that file. I am getting access denied error. Can anyone help me on this?
For more information, I have run the IIS as well to keep container alive.
Net Use command:
Net use * "" /user:<username> /p:yes
CMDKey command
cmd.exe /C "cmdkey /add: /user:<username> /pass:"
While doing the same thing with Console Application, I am able to access the file server path from inside container but not working for window service.
Docker tomcat container saves the startup log of the tomcat application in catalina.out file (last line would INFO: Server startup in 136607 ms). But rest of the activity of the tomcat app is logged onto to console and can be viewed with docker logs container_id.
Is there a way to log to file and console as well? I need the activity log inside catalina.out.2021.log in the tomcat container so I can run a script that collects analyze the logs and process it and sends email and It needs to run inside the container.
Tomcat is started with custom logging properties file /usr/local/tomcat/conf/logging.properties but the output is ending up on console and not in file.
In the image you are using (hobsonspipe/centos-tomcat7:latest) the server is started with:
-Djava.util.logging.config.file=/etc/tomcat/logging.properties
So you need to modify the /etc/tomcat/logging.properties file instead of the one used in your question. This file already does what you want: it sends all Tomcat logs to the standard output and /var/log/catalina.<date>.log, except log messages from the applications (if they use the SevletContext#log method) which go to /var/log/localhost.<date>.log.
If your application doesn't use neither ServletContext#log or java.util.logging, you must configure the specific logging framework elsewhere.
I am running the ONgDB container as per their Docker run command.
I have tested this locally on my laptop and it worked before, I was able to navigate to the graph browser and log in.
Now I am running this Graph in a server.
I did port forwarding to my laptop successfully, and am able to see ONgDB Browser in my laptop. However I am unable to log in, I get the error:
ServiceUnavailable: WebSocket connection failure. Due to security constraints in your web browser, the reason for the failure is not available to this Neo4j Driver. Please use your browsers development console to determine the root cause of the failure. Common reasons inc...
I found Neo4J article on how to resolve it.
I entered the ONgDB container filesystem and opened the .conf file, but there was no line to uncomment.
I tried to add the suggested line dbms.connector.bolt.address=0.0.0.0:7687 but it does not work as well.
How can I enable ONgDB Docker container for remote access?
I figured out the problem, in Neo4J/ONgDB browser, it fills the database host with localhost by default.
You just have to fill it in with the server's IP there and it works.
Also, you can connect using a desktop Neo4J/ONgDB browser to a remote graph, its just like a database (RDBMS) where you can connect to it from a client running locally.
Is there a way to pick up the log messages which are logged to a log file, when using the syslog log driver of Docker?
Whatever I write to sysout are getting picked by Rsyslog but anything logged to a log file is not picked. I don't see any option in the syslog driver option which could help indicate a log file to be picked up.
Thanks
Dockers logging interface is defined as stdout and stderr, so the best way is to modify the log settings of your process to send any log data to stdout and stderr.
Some applications can configure logging to go directly to syslog. Java processes using log4j are a good example of this.
If logging to file is the only option available, scripts, logstash, fluentd, rsyslog, and syslog-ng can all ingest text files and output syslog. This can either be done inside the a container with an additional service, or using a shared, standardised logging area on each Docker host and running the ingestion from there.
I have rails application on passenger web server running in docker container. I'm trying to redirect application logs to Logstash. I redirect rails logs to STDOUT and configure container to use gelf log driver, wich redirects STDOUT to given Logstash server. But problem arises: Passenger web server writes his own logs to STDOUT too. And I get mixture of two logs, what make it difficult to separate and analyze.
What is best practices in such situation? How could I label each log stream to separate it in logstash?
If you really wanted, you could configure Passenger to write to its own stdout log, but I would avoid using STDOUT as an intermediary for logstash.
Try a library like logstash-logger. You could then write to a separate file, socket, or database. I think that's a cleaner approach, and potentially faster depending on the log destination.