Pushing logs to hosted Loki results in "no credentials provided" error.
See original GitHub issueI use Grafana cloud which provides hosted Loki. The current setup logs to a file and Promtail push the logs to Loki. The Promtail configuration for Loki accepts a URL that has the username and password along with the URL. The format of the URL is: https://9xxx:<my_api_key>=@logs-prod-us-central1.grafana.net/api/prom/push
. I was trying the appender to replace the promtail configuration. The appender configuration looks like:
<appender name="LOKI" class="com.github.loki4j.logback.LokiApacheHttpAppender">
<encoder class="com.github.loki4j.logback.JsonEncoder">
<label>
<pattern>host=${HOSTNAME},level=%level</pattern>
<pairSeparator>,</pairSeparator>
<keyValueSeparator>=</keyValueSeparator>
<nopex>true</nopex>
</label>
<staticLabels>false</staticLabels>
</encoder>
<url>https://9xxx:<my_api_key>=@logs-prod-us-central1.grafana.net/api/prom/push</url>
<connectionTimeoutMs>30000</connectionTimeoutMs>
<requestTimeoutMs>5000</requestTimeoutMs>
</appender>
I get this error with the above configuration:
12:45:02,845 |-ERROR in com.github.loki4j.logback.LokiApacheHttpAppender[LOKI] - Loki responded with non-success status 401 on Batch #2d7ce8a75e8 (13 records). Error: {"status": "error", "error": "no credentials provided"}
Does the appender support pushing logs to hosted Loki?
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
Trailing / in storage_config.s3 results in ... - GitHub
Send some logs using /api/prom/push. Expected behavior. Trailing slash is detected and not used in object key generation, so no error occurs.
Read more >Configuration | Grafana Loki documentation
The result is the value for every config object in the Loki config struct, which is very large… Many values will not be...
Read more >Logging in Kubernetes with Loki and the PLG stack
Use the PLG (Promtail, Loki, Grafana) log stack to discover, transform, ... Promtail can attach labels to logs before pushing them to Loki....
Read more >Loki Distributed with S3 backend - Timestamp and Grafana ...
For the loki I am able to figure out the issue. In the sample Loki configuration on the official website, it is mentioned...
Read more >How To Deploy Grafana Loki and Save Data to MinIO
Install and configure Loki, Promtail, Grafana and MinIO to quickly get started working with log data.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@deepu-james The final release is expected to be out within one or two weeks. Meanwhile you can try pre-release version
1.0.0-rc1
. The configuration changed significantly, and I need to update docs before releasing the whole thing. But given the configuration you’ve provided in this issue, you can rewrite it as the following (omitting some defaults):If you encounter any issues, feel free to report!
Thanks for reporting! I haven’t checked if appenders can push logs to Grafana Cloud. This could require some additional configs for HttpClient. I’ll investigate this and update the issue with the results.