loki4j / loki-logback-appender

Fast and lightweight implementation of Logback appender for Grafana Loki
https://loki4j.github.io/loki-logback-appender/
BSD 2-Clause "Simplified" License
314 stars 27 forks source link

Loki4j Fails to log with the following error #164

Closed ajayaviyyapu closed 1 year ago

ajayaviyyapu commented 1 year ago

Hi I am using the loki-logback-appender in my project. Following are the dependencies which we are using in our Spring Boot project. We are using Java11 version.

<dependency>
    <groupId>com.github.loki4j</groupId>
    <artifactId>loki-logback-appender</artifactId>
    <version>1.3.2</version>
</dependency>
<!-- use the httpclient for loki appender -->
<dependency>
    <groupId>org.apache.httpcomponents</groupId>
    <artifactId>httpclient</artifactId>
</dependency>

We have some slow HTTP GET Requests which takes more time to respond. For these requests loki4j component is producing the following error. Please find the logs which shows the error from Loki4j.

[2m2022-12-04 11:36:29.624[0;39m [32m INFO [SimulationService,68503b7196796cff,68503b7196796cff][0;39m [35m1[0;39m [2m---[0;39m [2m[tp320605039-343][0;39m [36md.n.common.logging.NoxRequestMdcFilter [0;39m [2m:[0;39m Slow request to GET /app/addresses?search=122796&type=consigner detected, running for 97801ms 11:36:39,489 |-ERROR in com.github.loki4j.client.pipeline.DefaultPipeline@6fa3c3f9 - Loki responded with non-success status 400 on batch #bc1b001da45 (1,034 bytes). Error: 1:225: parse error: unexpected character inside braces: '.'

[2m2022-12-04 11:37:31.703[0;39m [32m INFO [SimulationService,a41157d74faadfc0,a41157d74faadfc0][0;39m [35m1[0;39m [2m---[0;39m [2m[tp320605039-372][0;39m [36md.n.common.logging.NoxRequestMdcFilter [0;39m [2m:[0;39m Slow request to GET /app/addresses?search=122796&type=consigner detected, running for 99876ms 11:37:31,798 |-ERROR in com.github.loki4j.client.pipeline.DefaultPipeline@6fa3c3f9 - Loki responded with non-success status 400 on batch #bcddde76d8c (1,034 bytes). Error: 1:225: parse error: unexpected character inside braces: '.'

[2m2022-12-04 11:38:24.053[0;39m [32m INFO [SimulationService,4d6b34d991336319,4d6b34d991336319][0;39m [35m1[0;39m [2m---[0;39m [2m[tp320605039-119][0;39m [36md.n.common.logging.NoxRequestMdcFilter [0;39m [2m:[0;39m Slow request to GET /app/addresses?search=122796&type=consigner detected, running for 92224ms 11:38:24,111 |-ERROR in com.github.loki4j.client.pipeline.DefaultPipeline@6fa3c3f9 - Loki responded with non-success status 400 on batch #bda0bd173d7 (1,034 bytes). Error: 1:225: parse error: unexpected character inside braces: '.'

nehaev commented 1 year ago

Hi @ajayaviyyapu, thanks for reporting this! A few questions to clarify:

  1. What format do you use for sending logs to Loki, json or protobuf?
  2. Could you please provide an example log message that causes this parse error you mentioned?
nehaev commented 1 year ago

Feel free to re-open if there's more info on how to reproduce this.