vectordotdev / vector

A high-performance observability data pipeline.
https://vector.dev
Mozilla Public License 2.0
18.29k stars 1.61k forks source link

feat(amqp sink): Add ability to use message persistence #16965

Open andrejbaran opened 1 year ago

andrejbaran commented 1 year ago

A note for the community

πŸ™‹ I am more than happy to work on this as it seems to be an easy task to do and since no one else (to my knowledge) raised this "issue" yet

Use Cases

In order to ensure logs really make it to processing/end storage while using AMQP sinks it would be really great to have an option to mark the message as persistent. This way logs (marked as such, like audit logs for instance) would survive restart of AMQP component (e.g. RabbitMQ).

Attempted Solutions

Unfortunately persistence in RabbitMQ can be setup only at the producer level and not via policies so there is really no other option how to achieve this than adding this to vector itself in one way or another.

Proposal

There are several approaches to tackle this:

Add an optional AMQP sink configuration field (like mark_persistent for instance)

References

No response

Version

vector 0.28.1 (x86_64-unknown-linux-musl ff15924 2023-03-06)

egorovd commented 1 year ago

Can not understand... )) Who does not need such a useful thing?

jszwedko commented 1 year ago

Can not understand... )) Who does not need such a useful thing?

We are open to a PR here :) It should be a relatively straight-forward change to expose.

egorovd commented 1 year ago

We are open to a PR here :) It should be a relatively straight-forward change to expose.

I decided to use vector in one of my projects... And rested on the fact that I can’t do it because of this thing. Now looking for alternative solutions... Maybe fluentd, haven't decided yet. But as soon as this thing appears, you will definitely pass on it. Pretty cool product. Taking off my hat. Thank you.

P.S. If today it was added, I would build vector from the source. ))

andrejbaran commented 1 year ago

@jszwedko great. I will find some time to implement it. Sorry for the late reply.

andrejbaran commented 1 year ago

@jszwedko which solution of those mentioned would you guys prefer?

jszwedko commented 1 year ago

@jszwedko which solution of those mentioned would you guys prefer?

Is it common to only want certain messages to be persistent? If it is, than the template approach makes sense. Otherwise I would say just go with a boolean.

I would not go with the third approach since we don't have any precedent for that pattern in Vector at the moment.

andrejbaran commented 1 year ago

Is it common to only want certain messages to be persistent? If it is, than the template approach makes sense. Otherwise I would say just go with a boolean.

Well, that depends I guess. I'd say it could be a valid scenario, where for example you absolutely don't want to loose audit log messages or certain levels of but you don't mind if you loose some extent of others (e.g. some levels of infrastructure or application logs)

I don't think there is a "common theme" here since that might vary a lot 🀷 so I would say the template way is "safer" ?

andrejbaran commented 1 year ago

@jszwedko Now that I think of it I would go for the simple boolean. One can always create separate sinks (with same/similar configuration) and route logs to respective sinks if needed.

Since there wasn't a real need for this feature anyway (4 πŸ‘ including mine 😁 ) I will go for the boolean.