== Logs and Metrics

=== Logs

James exposes its logs on the console. Then a fluent bit instance scraps
and collects them, before being indexed and used by Kibana, with nice
search possibilities.

The way James exposes its logs on the console is defined in the
`logback.xml` configuration file. James currently exposes logs in JSON
format using Jackson Json formatter.

=== Metrics

James exposes its metrics over an HTTP Webadmin endpoint, something like
`https://james-web-admin/metrics`. Those metrics can be scraped by
Prometheus before being visualized on Grafana.

This Helm chart exposes James metrics through Prometheus
https://github.com/prometheus-operator/prometheus-operator/blob/master/Documentation/user-guides/getting-started.md#include-servicemonitors[ServiceMonitor].

You can import the dashboards for James metrics in Grafana defined
https://github.com/apache/james-project/tree/master/server/grafana-reporting/prometheus-datasource[here].

Be aware that those dashboards still need more work, as we used to
export metrics to Elasticsearch not long ago, which required to redo all
dashboards. Some enhancements are highly possible and encouraged.

Read more about xref:distributed/operate/metrics.adoc[Metrics in James].