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

Is there a way to get the chunk ID at the custom GO output plugin level ? #67

Open
Nicusor97 opened this issue Jul 17, 2023 · 3 comments

Comments

@Nicusor97
Copy link

I'm looking for a way to get the chunk ID (which I suppose is unique per chunk) at a custom GO output plugin level.
I'm using Fluent-Bit with an Tail input plugin (default one) and a GO custom output plugin that is used to forward the data to specific output.

Our infrastructure is based on retries and we adding some audits logs where we log each line from a chunk just to be collected by a log agent and pushed to Kibana. Since the same chunk is retried multiple times, I want to somehow get the unique ID of that specific chunk, store it in memory and at the next validations make sure the same ID is used in logs so we can filter by that specific space ID.

Long story short, these are my questions:

  1. Is there a way to get the chunk ID at a custom GO output plugin level considering I'm using an TAIL input plugin ?
  2. Is there is no way to get the chunk ID, do you have any suggestion for how to map the chunk to something unique so I will be aware of the chunk's unicity when I log the action (retry, fail, sent)?

Thank you!

@l2dy
Copy link
Contributor

l2dy commented Jul 17, 2023

For output to Elasticsearch, you could use the native plugin which supports Generate_ID or Id_Key to prevents duplicate records.

@Nicusor97
Copy link
Author

Ah, I think I was not clear enough.
My custom Output plugin is perform HTTP calls to a Web Service with batches of events. Each time when a action is performed I do print a log into a file that is scraped by another agent which is forwarding the logs generated by the Output plugin in OpenSearch. At the output plugin level there is nothing related to OpenSearch.

@l2dy
Copy link
Contributor

l2dy commented Jul 18, 2023

The simple answer is you can't. Only a tag and data, which includes timestamp and optional metadata, can be passed to a Go plugin. https://github.com/fluent/fluent-bit/blob/master/src/proxy/go/go.c#L138-L143

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

No branches or pull requests

2 participants