apache-camelapache-camel-k

Where is the logs in Camel K integration pod


Update

# access to the container
kubectl exec -it -c integration my-route-80b4cb7566-v6l7m /bin/sh

# go to directory
cd /tmp

Both the answers of Squake and Nicola are working properly. To check the generate logging file, you need to access to the container and check the right directory:

Original Question

I have an integration pod running with kamel:

kamel run MyRoute.java

I have log in the route

from("...")
.log("my log message")

I am able to check the log lines with command:

kubectl logs my-route-85d7f65c96-rmb4z --tail=10

Then I am able to access to the pod using:

kubectl exec -it -c integration my-route-85d7f65c96-rmb4z /bin/sh

I tried to check folder /var/log, unfortunately there's no related log files.

I have 2 questions on this:

Thanks


Solution

  • By default, the integration only logs into standard output, so that logs can be gathered by Kubernetes.

    You can provide advanced logging configuration using Quarkus properties.

    E.g. Create a logging.properties file with the following content:

    quarkus.log.file.enable=true
    quarkus.log.file.path=/tmp/camel.log
    quarkus.log.file.level=INFO
    

    Then run the integration with:

    kamel run MyRoute.java --property=file:logging.properties
    
    

    You'll find a camel.log file under /tmp with the INFO logs. You can find more examples here: https://quarkus.io/guides/logging.

    You can write logs to any dir where the process has write access, including you own PV if needed.