I am looking for a way to store and query logs generated by Kubernetes pods (using the command kubectl logs -n ) directly in Azure Monitor or Application Insights. Does anyone know if it's possible to integrate these services with Kubernetes logs? What options or configurations should I consider to achieve this?
I am looking for a way to store and query logs generated by Kubernetes pods (using the command kubectl logs -n ) directly in Azure Monitor or Application Insights. Does anyone know if it's possible to integrate these services with Kubernetes logs? What options or configurations should I consider to achieve this?
Share Improve this question edited yesterday Jahnavi 7,8381 gold badge6 silver badges12 bronze badges Recognized by Microsoft Azure Collective asked Jan 20 at 16:24 gocgoc 191 silver badge1 bronze badge 3- Please share more details about your ask – Harshitha Commented Jan 21 at 4:11
- Can you share the workaround tried so far! – Jahnavi Commented Jan 21 at 7:06
- What I want to know is if the pod logs, which can be viewed in AKS by running the command kubectl logs <pod_name> -n <namespace>, can be stored in Azure Monitor or Application Insights. – goc Commented Jan 22 at 15:58
1 Answer
Reset to default 0To store and query logs generated by Kubernetes pods directly in Azure Monitor or Application Insights, you need to enable container logs under Azure Monitor section while creating the cluster as shown below. Once it is enabled, all the logs will be integrated and managed by Prometheus and Grafana workspaces as well.
Once the cluster creation is done, you can go to Monitor >> Managed Services
to view the pods and the respective logs as shown below.
Also, when it is linked to Azure Monitor while creation of the cluster, there will be a specific workspace attached to it which will also collect the logs as shown below.
I have executed below sample query to view the pods logs and was successful.
KubePodInventory
| project Name