Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Add Grafana Loki JSON format #1853

Closed
wants to merge 1 commit into from

Conversation

simonswine
Copy link

This allows to use the existing HTTP output to push logs into Grafana Loki. This uses the JSON format for pushing logs into Loki (using protobuf would require more dependencies). (cf. #994)

My use case is to ship logs into Loki from embedded devices, where Grafana's existing golang plugin (grafana/loki#847) is not ideal.

I am more than happy to provide more quality (docs, tests, ...). But first I would like to understand if this is something that would be accepted upstream.

A config would look like this:



[OUTPUT]
    Name         http
    Match        *
    Host         loki.example.net
    Port         443
    URI          /loki/api/v1/push
    Format       json_loki
    tls          On
    tls.debug    1
    tls.key_file client.key
    tls.crt_file client.crt

To test the JSON format stdout can also be used:

[OUTPUT]
    Name   stdout
    Match  *
    Format json_loki

I think ideally we would also merge matching labels into a single array element. I certainly would love some feedback as my last C project is some time ago :)

This allows to use the existing HTTP output to push logs into Grafana
Loki. This uses the JSON format for pushing logs into Loki, as using
protobuf would require more dependencies. (cf. fluent#994)

Signed-off-by: Christian Simon <simon@swine.de>
@jcdauchy
Copy link

Just curious, what are the advantages compared to the fluent-bit loki plugin ?

Thanks

@edsiper
Copy link
Member

edsiper commented Jan 25, 2020

@simonswine thanks for this contribution! we got many requests to have Loki support.

I would like to know what do you think the approach to implementing a native Loki C plugin, I'd be happy to help to implement the basics structure so you might continue with the formatting if required.

The current PR cannot be merged since it touches different areas with formatting just for Loki and we aim to keep the core components agnostic from destination format/protocols specifics.

let me know what do you think

@edsiper
Copy link
Member

edsiper commented Nov 27, 2020

Loki C plugin is already implemented:

https://docs.fluentbit.io/manual/pipeline/outputs/loki

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants