-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
lokiexporter: Empty logs sended from otel collector #2529
Comments
Maybe we should reuse the mechanism inspired from fluentd loki plugin. I have the feeling than otel doesn't sends any "OTEL Attributes" to loki. |
Hum... I understand, FluentForward protocol seems not have a "raw" log body. In my case, I use Winlog input (https://github.com/fluent/fluent-bit/tree/master/plugins/in_winlog) and this plugin parse the win eventlog then forward all fields without adding a custom field message. So, I have some questions to discuss.
|
FluentReceiver related issue here : #14718 |
Thank you for filing this issue, @gillg!
I can't speak to the 'fluentforwardreceiver', but I will find someone who can.
I was torn on this when implementing the exporter. Based on the collector design, it is the responsibility of the receiver to properly format the data into the format collector pipelines understand. In this particular case, we're relying on the 'fluentforwarderreceiver' to ensure that the log body is properly filled prior to sending the data through the remainder of the pipeline. As you mentioned, it currently looks for "message" or "key" when creating the log body. While most of the time the data sent from Fluentd/Fluentbit contain either of these fields, it is not always the case (per your experience). This can be resolved upstream within Fluentd by transforming the data prior to sending it to the collector, but sometimes operators don't have control over that particular configuration / subsystem. Do you feel that a mechanism within the 'fluentforwarderreceiver' that allowed you to specify how to fill the log message when one isn't present would solve the empty log message issue for you? ( #14718) Or would like to have an option within the Loki exporter to dynamically fill the log message with attributes if one is not present? Or something else? As a Loki user, I would also love to get your thoughts on #2290 . |
@gramidt Thanks for your answer, I tried to workaround at fluentbit side... But after a long battle I abandoned and decide to learn Go to make my PR ^^
On OTLP exporter (for exemple) as it handle attributes + body, we have nothing to merge or drop. |
Thank you for the prompt followup, @gillg!
Hmm..I'm going to need to think through this a bit more. At this time, I feel that if manipulation is being performed to properly fill the log data it must be done within the corresponding receiver or maybe even a processor. There are cases where it would make sense to do certain transformations on the exporter side, but only when it's a requirement of that particular destination and not a shared requirement across multiple exporters. In this particular case, I personally believe the 'fluentforwardreceiver' could be updated to provide the necessary configuration to fill the log body however you see fit, so that any downstream exporter can rely on the log without having to re-implement logic to fill the log body. |
@bogdandrutu @tigrannajaryan - Could you assign this to me? |
I'm pretty aggree, but if we consider OTEL Collector as a data pipeline, it's acceptable to have a different log to export, between the receiver and the exporter. OTEL logs are defined here : https://github.com/open-telemetry/opentelemetry-collector/blob/2a743aaa117f911976049628a926a6efead5e417/internal/data/protogen/logs/v1/logs.pb.go#L268, In my opinion, if the target (after the exporter) can handle OTEL attributes it's ok, but if it can't we should adapt the log to avoid any loss of information. What is the objective to add processors on OTEL collector if it works on attributes and if you don't export attribute on your target ? |
Bumps [github.com/golangci/golangci-lint](https://github.com/golangci/golangci-lint) from 1.36.0 to 1.37.1. - [Release notes](https://github.com/golangci/golangci-lint/releases) - [Changelog](https://github.com/golangci/golangci-lint/blob/master/CHANGELOG.md) - [Commits](golangci/golangci-lint@v1.36.0...v1.37.1) Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
For tracking / reference: Similar issues and potential improvements discussed to the log receivers to help address the empty log/message field: |
Hello, I can't reopen my PR, but we always need to find a solution for this issue. |
I'm looking at a related issue of not all the information in the LogRecord being sent to loki (only the body is currently sent, and only if it is a string). The way I'm proposing to address this is by adding an "encoding" config parameter with possible values of "json" or "none". "none" would cover the existing behavior. "json" would json encode the entire LogRecord so it would look something like:
|
* un-escape url coding when parsing baggage. * Added changelog Co-authored-by: Aaron Clawson <[email protected]> Co-authored-by: Tyler Yahn <[email protected]>
Hi, I think I have similar problem. These are the output from fluentbit
These are the sample logging output from collector
The body part is not consistent. |
I'll give this a try, but I believe it should be possible to have entries without body. Could you confirm which format you used for this? Was it json, or was it "body"? |
This issue has been inactive for 60 days. It will be closed in 60 days if there is no activity. To ping code owners by adding a component label, see Adding Labels via Comments, or if you are unsure of which component this issue relates to, please ping |
@mar4uk, are you able to confirm that we are able to ingest log entries without a body in the Loki exporter? |
@mar4uk, you might have missed this in the middle of the notification storm over the holidays :-) |
sorry for the delay, I will take a look at it soon |
yes, we are able to ingest log entries without a body in the Loki exporter Config example:
curl:
HTTP/1.1 200 OK This is how log entry is shown in Loki (no body field, log entry is correct): |
@alfianabdi the example in your comment looks like the problem on the receiver side, not on the exporter side, right? |
Perhaps this is related to open-telemetry/opentelemetry-collector#7009 ? |
Hello :) I have similar issue than @alfianabdi . This is my config: Kind config
I install fluent bit / opentelemetry / loki via Helm chart. Fluent bit ConfigurationImage: 2.0.9-debug
Opentelemetry mode daemonsetImage: v0.67.0
Simple pod
Fluent bit Log
Opentelemetry logs
It's strange because Fluentbit seems to send the data to opentelemetry but not formatted correctly ? (No attributes) This is how log entry is shown in Loki: Do you think i need to play with the lokiexporter via resource / attributes ? It will be great to filter my logs with filters container / pod ... |
yes, it seems so. All data is sent within the body
you can filter your logs using json parser. The query will look something like this: |
I don't think it is related. That issue is about sending an empty body to the collector endpoint. Whereas this issue is about sending the empty body of Loki entry. The current logic of loki exporter is correct: if loki exporter gets a LogRecord with an empty Body it sends loki entry with an empty body to Loki. The responsibility of filling LogRecord Body is on the receiver or processor side I think this issue could be closed. |
Thanks @mar4uk 😄 Now i need to check why my Fluentbit label add inside my Fluentbit conf doesn't work. |
@gillg loki exporter was updated, and new formats were added: |
I think we are good indeed. |
it seems that for the fluentreceiver the issue was created some time ago #2870 |
Help and patches are very welcome. Happy to review if you have improvements. |
Describe the bug
Otel Collector receive logs from fluent-bit, process them as batch, and export them to console + loki.
On console everything seems good, but on loki they are "empty"
All my logs have no "body" or any attributes.
Console exporter output :
Steps to reproduce
What did you expect to see?
Logs on loki...
Exemple with fluent-bit > fluetnd > loki
What did you see instead?
See above
What version did you use?
Loki : grafana/loki:master (2.1.0+)
Otel collector: otel/opentelemetry-collector-contrib:latest
The text was updated successfully, but these errors were encountered: