How to track info logs on kubernetes pod

Andreas Christofi 96 Reputation points
2021-03-01T13:37:01.82+00:00

Hello,

My kubernetes microservice only displays error logs in the Live Logs and Log Analytics. Is there a way to enable info logs generated from the python code in the container for my pod? Thanks.

Azure Kubernetes Service
Azure Kubernetes Service
An Azure service that provides serverless Kubernetes, an integrated continuous integration and continuous delivery experience, and enterprise-grade security and governance.
2,458 questions
{count} votes

2 answers

Sort by: Most helpful
  1. SUNOJ KUMAR YELURU 15,491 Reputation points MVP Volunteer Moderator
    2021-03-02T00:32:38.407+00:00

    Hi @Andreas Christofi
    Use the following procedure to view the live logs for deployments that are part of of AKS clusters that are not monitored by Azure Monitor for containers. If your cluster uses Azure Monitor for containers then use the process below to view the live data for nodes, controllers, containers, and deployments.
    View deployment live logs (preview)

    You can view real-time log data as they are generated by the container engine from the Nodes, Controllers, and Containers view.
    Select an object from the performance grid, and on the properties pane found on the right side, select View live data (preview) option

    If the Answer is helpful, please click Accept Answer and up-vote, this can be beneficial to other community members.

    0 comments No comments

  2. Andreas Christofi 96 Reputation points
    2021-03-04T07:08:58.3+00:00

    I found the solution to be setting the logging level to "info" in code. By default, live logs show only errors and warnings sent to stderr. Enabling info logs shows too many logs that are generated by the container and kubernetes service, therefore logging messages as "warning" or as a custom level above "info" might be a good approach.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.