Body: <p>I am looking for a mechanism/tool to collect and query logs of applications running in Kubernetes pods. This is to provide a log viewer for users.</p>
  <p>These are the main requirements</p>
  <ul>
  <li>These users do not have direct access to the cluster to view logs (e.g. To execute <code>kubectl logs</code>)</li>
  <li>The solution should scale in a cluster with nodes in the double digit range and hundreds of pods per node.</li>
  <li>There is a requirement that logs should not leave the cluster. Therefore cloud based tools cannot be used.</li>
  <li>Logs from multiple pods may need to be retrieved at once and multiple users may do so simultaneusly. So the solution should be able to handle such loads</li>
  <li>If it's a tool, it should have an endpoint (E.g. REST API) that can be used to query logs if we do not want to use the tool's built in UI</li>
  </ul>
  <p>The first option I looked at was using the <a href="https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#get-read-log-of-the-specified-pod" rel="nofollow noreferrer">GET /api/v1/namespaces/{namespace}/pods/{name}/log</a> Kubernetes REST API. The concern here is that concurrent requests to retrieve logs of multiple pods might overload the API server and result in it being unable to handle rest of the cluster operations. So it's not possible to query the API server.</p>
  <p>I also had a look at using Fluent Bit with an output plugin. Several output plugins I checked integrate with comprehensive observability platforms. I would still be able to get logs through them. But they might be an overkill only for logs. Hence a tool specifically built for logs would be preferable. One lightweight output plugin I found is Vivo exporter which I am currently evaluating.</p>
  <p>Do you all have suggestions for any other tools that can be used to collect and query pod logs?</p>
  
Comments: CC BY-SA 4.0
Comments: 2023-06-06T08:53:14.493Z
Comments: [Kibana](https://www.elastic.co/kibana/) is a tool that you may use to visualize and explore data and logs from k8s clusters. ACL can be tuned.
Comments: ponsfrilus
Comments: CC BY-SA 4.0
Comments: 2023-06-08T17:24:32.137Z
Comments: check out loki stack (https://grafana.com/oss/loki/) for log aggregation and analysis
Comments: Taimoor Mirza
Tags: <kubernetes>
Title: Tool to collect and query Kubernetes pod logs
UserDisplayName: Nilushan Costa
ThreadText: # Tool to collect and query Kubernetes pod logs
  
  (Asked by: username_0 on 2023-06-05)
  
  I am looking for a mechanism/tool to collect and query logs of applications running in Kubernetes pods. This is to provide a log viewer for users.
  
  These are the main requirements
  
  * These users do not have direct access to the cluster to view logs (e.g. To execute `kubectl logs`)
  * The solution should scale in a cluster with nodes in the double digit range and hundreds of pods per node.
  * There is a requirement that logs should not leave the cluster. Therefore cloud based tools cannot be used.
  * Logs from multiple pods may need to be retrieved at once and multiple users may do so simultaneusly. So the solution should be able to handle such loads
  * If it's a tool, it should have an endpoint (E.g. REST API) that can be used to query logs if we do not want to use the tool's built in UI
  
  The first option I looked at was using the [GET /api/v1/namespaces/{namespace}/pods/{name}/log](https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#get-read-log-of-the-specified-pod) Kubernetes REST API. The concern here is that concurrent requests to retrieve logs of multiple pods might overload the API server and result in it being unable to handle rest of the cluster operations. So it's not possible to query the API server.
  
  I also had a look at using Fluent Bit with an output plugin. Several output plugins I checked integrate with comprehensive observability platforms. I would still be able to get logs through them. But they might be an overkill only for logs. Hence a tool specifically built for logs would be preferable. One lightweight output plugin I found is Vivo exporter which I am currently evaluating.
  
  Do you all have suggestions for any other tools that can be used to collect and query pod logs?
  
  **Tags:** kubernetes
  
  > **Comments:**
  > **username_1**: [Kibana](https://www.elastic.co/kibana/) is a tool that you may use to visualize and explore data and logs from k8s clusters. ACL can be tuned.  
  > **username_2**: check out loki stack (https://grafana.com/oss/loki/) for log aggregation and analysis  
  
  ---
  
  ## 0 answers
  
  