quarkusio/quarkus

Structured Access Logs

Open

#23.407 geöffnet am 3. Feb. 2022

Auf GitHub ansehen
 (6 Kommentare) (10 Reaktionen) (0 zugewiesene Personen)Java (2.464 Forks)batch import
area/logginggood first issuekind/enhancement

Repository-Metriken

Stars
 (12.967 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 6T 4h) (325 gemergte PRs in 30 T)

Beschreibung

Description

As an SRE I would like the access logs to emit structured information when using quarkus-logging-json So that I can filter logs more efficiently

At the moment when using Quarkus access logging with something like Splunk or Kibana, important information like response status code, request URI, response size etc is only available in the message

These should be available as separate JSON properties on the log event so that I can easily filter the logs

Implementation ideas

logback-access does this well when combined with logstash-logback-encoder and emits something along the lines of:

{
  "@timestamp": "2021-05-04T18:24:25.720+01:00",
  "status_code": 404,
  "method": "GET",
  "protocol": "HTTP/1.1",
  "requested_uri": "/api/v1/resource/12345678",
  "remote_host": "127.0.0.1",
  "content_length": -1,
  "elapsed_time": 76,
  "level": "DEBUG",
  "logger_name": "access.log",
  "message": "127.0.0.1 - - [2021-05-04T18:24:25.720+0100] \"GET /api/v1/resource/12345678 HTTP/1.1\" 404 -1",
}

Contributor Guide