<p>I am looking for a way to collect Java exceptions thrown by containers. I know the function from the logging system of GKE/GCP and would like to implement a similar logging system in our self-hosted cluster.</p>
<p>I am using Prometheus and Grafana for monitoring metrics.</p>

<p>You need a centralized logging solution. There are some common solutions out there. One of them is the ELK Stack (now named Elastic stack).</p>
<p>It has 3 main components:</p>
<ol>
<li><p><strong>Elasticsearch:</strong> To store the logs, index them, make them searchable etc.</p>
</li>
<li><p><strong>Logstash:</strong> To collect the logs from various sources (containers in your case), parse/filter them and push them to other systems. In ELK's case, push them to Elasticsearch.</p>
</li>
<li><p><strong>Kibana:</strong> A web GUI to visualize the data in Elasticsearch, allows searching, creating visual graphs and so on.</p>
</li>
</ol>
<p>See the official page of <a href="https://www.elastic.co/what-is/elk-stack" rel="nofollow noreferrer">Elastic stack</a> for more information.</p>
<p>You can also use <a href="https://www.fluentd.org/" rel="nofollow noreferrer">Fluentd</a> or <a href="https://fluentbit.io/" rel="nofollow noreferrer">Fluent Bit</a> instead of Logstash, so it'll be an EFK stack. I personally had pretty good experience with an EFK stack with Fluent Bit.</p>
<p>For another, lighter alternative, you can check out <a href="https://grafana.com/oss/loki/" rel="nofollow noreferrer">Grafana Loki</a>, which is kind of a logging extension to the popular monitoring setup of Prometheus+Grafana.</p>
