Where is the logs in Camel K integration pod

Viewed 245

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:

  • Where is the log file location in the integration pod?
  • How can I specify log file location?

Thanks

2 Answers

A Camel K Integration works like any Camel Quarkus application, so, we must provide the proper settings as expected by Camel Quarkus:

kamel run Sample.java --dev -p quarkus.log.file.path=/tmp/trace.log -p quarkus.log.file.enable=true

The default is to have the log to standard output stream. You can configure adding all the properties needed. Certain configuration are also present in the logging trait.

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.

Related