Logs
Updated docs for logs is currently being worked on.
We use Grafana Loki for logging. Logs from applications in GAP are automatically picked up and sent to Loki. Logs can be explored in Grafana.
In Kubernetes we do not write logs to file — we write them to stdout. From there, an OpenTelemetry collector picks them up and sends them to Grafana Loki 🔎
Logging in JSON format from Spring Boot​
Use the Logstash Logback Encoder to write structured logs to stdout. Add the dependency:
<dependency>
<groupId>net.logstash.logback</groupId>
<artifactId>logstash-logback-encoder</artifactId>
<version>changeme</version> <!-- Get latest version from https://github.com/logstash/logstash-logback-encoder -->
</dependency>
Then configure logback-spring.xml (Spring logback reference) with a JSON console appender that is only active outside local development:
<configuration>
<appender name="consoleJSONAppender" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="net.logstash.logback.encoder.LogstashEncoder" />
</appender>
<!-- Use Spring Boot default appender for local development -->
<springProfile name="local">
<include resource="org/springframework/boot/logging/logback/base.xml" />
</springProfile>
<!-- Use Logstash JSON appender when running in a Kubernetes Pod -->
<springProfile name="!local">
<root level="INFO">
<appender-ref ref="consoleJSONAppender"/>
</root>
</springProfile>
</configuration>
Gjensidige Security Logging Standards​
You are responsible and accountable for ensuring that your application logs follow Gjensidige Security Logging Standards. We send logs to Splunk Cloud and this standard ensures that we don't violate our agreement with them as well as EU laws.
Read Datatilsynet's definition writeup on Hva er en personopplysning?