trea / caddy-loki-logger

Push logs from your Caddy web server directly to a Loki instance
3 stars 0 forks source link

Using env.LOKI_SERVER does not seem to work #4

Closed valankar closed 6 months ago

valankar commented 6 months ago

I tried to setup an environment variable for the loki server.

{
        log default {
                output loki {env.LOKI_SERVER} {
                        label {
                                job caddy
                        }
                }
        }

I see this in the logs:

{"level":"info","ts":1713374478.7145693,"msg":"redirected default logger","from":"stderr","to":"%7Benv.LOKI_SERVER%7D"} 

Whereas normally I would see the URL. Also it seems my Loki server stopped getting any data when I do this.

valankar commented 6 months ago

I run Caddy in docker, and when I exec a shell, I can echo $LOKI_SERVER and it has the correct URL.

trea commented 6 months ago

Try {$LOKI_SERVER} instead please

valankar commented 6 months ago

Yep, that works!

trea commented 6 months ago

Awesome. Thank you for the PR and for the questions!