quarkusio / quarkus

Quarkus: Supersonic Subatomic Java.
https://quarkus.io
Apache License 2.0
13.36k stars 2.56k forks source link

Option `quarkus.log.syslog.max-length` ignores text of the message #41166

Open fedinskiy opened 3 weeks ago

fedinskiy commented 3 weeks ago

Describe the bug

I have an application, which writes its logs into syslog. I use option quarkus.log.syslog.max-length to limit the length of the message. Despite that, when I log very long message (which contains more chars, than max-length), the message is not filtered.

Expected behavior

The long message is filtered.

Actual behavior

The message goes to syslog

How to Reproduce?

  1. git clone git@github.com:fedinskiy/reproducer.git -b syslog && cd reproducer . You can notice, that file application.properties contains this line: quarkus.log.syslog.max-length=64
  2. Start a syslog server, which will output received logs to the console: podman run -p 8514:514 -v $(pwd)/syslog.conf:/etc/syslog-ng/syslog-ng.conf:z --rm -it balabit/syslog-ng
  3. Start the app: mvn clean quarkus:dev
  4. curl localhost:8080 — syslogs console now contains a short message "Jun 12 16:40:43 localhost quarkus[111635]: INFO Root access"
  5. curl localhost:8080/long syslogs now contains a long message "Jun 12 16:42:18 localhost quarkus[111635]: INFO Message, which is very long and is not expected to fit into 64 bytes"
  6. Check the length of the message:
    $ echo "Message, which is very long and is not expected to fit into 64 bytes" | wc --chars --bytes
     69      69
  7. If we use more verbose logging format (mvn clean quarkus:dev -Dquarkus.profile=format), both short and long messages are not shown, which is more or less expected

Output of uname -a or ver

6.7.3-200.fc39.x86_64

Output of java -version

Java version: 21.0.1, vendor: Eclipse Adoptium

Quarkus version or git rev

3.11.1

Build tool (ie. output of mvnw --version or gradlew --version)

Apache Maven 3.9.6 (bc0240f3c744dd6b6ec2920b3cd08dcc295161ae)

Additional information

No response

fedinskiy commented 3 weeks ago

The option was introduced in this PR: https://github.com/quarkusio/quarkus/pull/39958

quarkus-bot[bot] commented 3 weeks ago

/cc @dmlloyd (logging)

dmlloyd commented 2 weeks ago

/cc @jamezp, I don't see any obvious cause for this. WDYT?

jamezp commented 2 weeks ago

Is the truncate configuration property set? It defaults to false which would mean a long message is split into multiple payloads and sent.