Open DavidKnacker opened 3 months ago
@DavidKnacker is the id missing even for logs generated by input plugin?
@Athishpranav2003 I haven't checked it for error logs thrown by an input plugin yet. But am I correct to assume that using @id to track errors should work for all kind of plugins? (or at least the ones that are shipped by default with fluentd?)
Ideally yes but since it's not behaving in that way I was checking what's the difference in underlying code Will check it meanwhile
Just ping me later with the case of input plugin
👍 will check the behavior for the input plugin tomorrow and report back
another scope of Idea: track plugin which emit error event in router side, then emit more user friendly error message.
Thanks for your report. This is Fluentd's specification.
This dump an error event
log is generated by RootAgent
(Fluentd's common logic).
The filter_parser
plugin just emits the error event to the router.
So, this log does not have its id.
Although this is the current specification, it looks like not so good. Maybe it could be improved somehow.
Although this is the current specification, it looks like not so good. Maybe it could be improved somehow.
It would be better to include the id of the plugin that emits the error event.
It may be easy to manually include the id of filter_parser
in the error info that it emits.
However, it is not so good because every plugin that emits error events needs to consider this issue.
As @kenhys says in https://github.com/fluent/fluentd/issues/4567#issuecomment-2259468182, it would be great if we could create a common mechanism for this.
another scope of Idea: track plugin which emit error event in router side, then emit more user friendly error message.
@daipom so basically we need to avoid change in function signature but capture the caller plugin id?
so basically we need to avoid change in function signature but capture the caller plugin id?
Yes.
We can't change the signature of emit_error_event()
because it is related to Event Emitter plugin helper API.
We need to keep compatibility for the plugins that use this function.
Why don't we use log.error method to generate the error log than emitting it as event(It's indirect but works the same way right)?
@Athishpranav2003 to come back to your question, I do see the @id field for logs generated by the input plugin.
Why don't we use log.error method to generate the error log than emitting it as event(It's indirect but works the same way right)?
@daipom what about this?
Are there any updates on this?
Sorry for my late response.
Why don't we use log.error method to generate the error log than emitting it as event(It's indirect but works the same way right)?
Filter plugin should use emit_error_event()
.
It outputs events as @ERROR
label.
It is intended to rescue collected data that could not be processed.
On the other hand, the events from Fluentd logger mean logs of Fluentd, not collected data by input plugins.
Fluentd logger outputs events as @FLUENT_LOG
label.
Using both would be a possible solution. However, it would be better if it could be resolved through a common mechanism.
I made a PR for this issue.
However, I'm concerned about some race conditions of the related existing logic...
I cannot say anything about potential race conditions, but I just tested the PR in my cluster and it seems to exactly achieve what I hoped for. Thanks @daipom! :) Would be great to have this in.
@DavidKnacker Thanks! I will check the race condition!
Hey @daipom, are there any updates on the ticket?
Sorry, we need to consider the race condition issue more. I wish we could get this into 1.18.0, but I am not sure...
Describe the bug
The @id plugin parameter is used to give each plugin its unique id. This id should be included in logs generated by said plugin. This seems to work inconsistent between different plugin types. I tested the json filter plugin (for which the id is not shown) and the loki output plugin (which shows it)
working example:
results in logs:
Both contain the "id_too_long_message" id of the plugin the error occured in.
But for the filter plugin:
The error:
does not contain the id "id_not_json" of the filter plugin that caused the error.
To Reproduce
The config:
results in:
Expected behavior
The @id fiel, if set, shows up in logs prodcued by the plugin. In this example I would expect:
Your Environment
Your Configuration