quarkusio/quarkus

Structured Access Logs

Open

#23.407 aperta il 3 feb 2022

Vedi su GitHub
 (6 commenti) (10 reazioni) (0 assegnatari)Java (2464 fork)batch import
area/logginggood first issuekind/enhancement

Metriche repository

Star
 (12.967 star)
Metriche merge PR
 (Merge medio 6g 4h) (325 PR mergiate in 30 g)

Descrizione

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",
}

Guida contributor