I’m running Alloy, version v1.7.5 in a docker container which collects from a log file. I would like a way to reset the collection and the log periodically but it seems the documentation is a bit misleading here as it says:
and this does not happen, instead the file is regenerated ( assuming it’s kept somewhere or in memory ) just as it was before I deleted it.
If there is any other way to reset Alloy I’d very much like to know it. So far the only way is to bring down the container and bring it back up.
Thanks for the help,
Alex
You need to stop Alloy, delete the file, then restart.
If you are running Alloy in Docker, depending on if you have the position file mounted into your Alloy container or not you may need to just restart the container.
Thanks for the answer. Do you happen to know if there are plans for a more elegant solution?
I am not sure why you would consider this to be a problem.
It’s pretty common that if you want to “reset” something the first thing you’d do is stop it before doing anything else.
It’s not a big issue but I need another component/service to restart alloy so it resets. Ideally from my point of view there’d be an API to tell it that or something internal that would tell it to reset without having another service doing this every once in a while. It would save some overhead basically.
For any other application, perhaps, but in logging pipeline I’ve personally never had to tell any logging agent to reset. Anecdotally speaking, I would consider this to be at best a niche use case, at worst a design problem.
I would like to reset every 30 days probably for storage purposes and one weird things that happens is that if I delete the log file alloy fills it up with NULLS to match the last position which looks a bit weird. I am fine with restarting but I think it is worth looking into a soft reset for the reasons I mentioned on this thread. Not sure how Alloy is built and if I could add a pull request depending on which language it was built in but would it be seriously considered if I take the time to do it?
You can find the source code for Alloy here: GitHub - grafana/alloy: OpenTelemetry Collector distribution with programmable pipelines
I am personally not a code contributor to Alloy, I would encourage you to submit an issue on Github and see how much traction it gains, as well as joining the Grafana community slack and see if you can get some inputs from the developers there.