Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I find the log file location in the integration pod? #2762

Closed
haifzhan opened this issue Nov 19, 2021 · 2 comments
Closed

How can I find the log file location in the integration pod? #2762

haifzhan opened this issue Nov 19, 2021 · 2 comments

Comments

@haifzhan
Copy link

haifzhan commented Nov 19, 2021

I have asked a question on StackOverflow(https://stackoverflow.com/questions/70042082/where-is-the-logs-in-camel-k-integration-pod) about camel k logging and paste it here for getting help:

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 If I want to log certain lines into a separated log file?

Thanks

@squakez
Copy link
Contributor

squakez commented Nov 22, 2021

I've just answered to the the post in SO, I see also @nicolaferraro provided the same information.

@squakez squakez closed this as completed Nov 22, 2021
@astefanutti
Copy link
Member

Where is the log file location in the integration pod?

Generally, containers write to stdout or stderr. That is the case for integration Pods, that rely on the Quarkus console log handler by default.

Then it depends on the container runtime that's setup for your cluster. With CRI-O, the log files are written in the /var/log/pods directory of the host node by default. It's /var/lib/docker/containers for the Docker container runtime. You can access this directory by accessing the node where the Pod is schedule, but it's also possible to mount the directory into a Pod.

How can I specify log file location If I want to log certain lines into a separated log file?

You can configure the Quarkus file log handler, e.g.:

$ kamel run -p quarkus.log.file.enable=true -p quarkus.log.file.path=/tmp/trace.log

Some examples of Quarkus logging configuration are available at https://quarkus.io/guides/logging#examples.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants