quarkusio/quarkus

Structured Access Logs

Open

#23.407 aberto em 3 de fev. de 2022

Ver no GitHub
 (6 comments) (10 reactions) (0 assignees)Java (2.464 forks)batch import
area/logginggood first issuekind/enhancement

Métricas do repositório

Stars
 (12.967 stars)
Métricas de merge de PR
 (Mesclagem média 6d 4h) (325 fundiu PRs em 30d)

Description

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

Guia do colaborador