Hi,
I thought that when I remove the positions.yaml file and restart Alloy, it triggers Alloy to read the logs again. However, I still see only [IN] in the Alloy GUI, but I don’t see any messages being sent out [OUT]. So how can I force Alloy to read those logs from scratch?
In fact, I checked my positions file and see almost the same value in KB for already read logs compared to the real KB size of that file.
$ stat -c %s /usr/logs/coin/coin_2025_05_26.log
33443
$ cat positions.yml
positions:
? path: /usr/logs/coin/coin_2025_05_26.log
labels: ‘{hostname=“coin_dev”, job=“coin”, log=“coin_log”}’
: “28207”
I am testing if ERRORS are correctly sent to Loki, that’s why for testing purposes I need a mechanism to read from scratch instead of waiting for new incoming logs.
Even if I remove positions.yaml, it recreates it again after a moment and already has the old offset saved, so removing the offset and restarting unfortunately doesn’t help
If you remove the positions file, it does not re-create with old values. It is re-created after Loki re-processed all your files, and it has the same values simply because your logs haven’t changed.
If you are not seeing logs in your destination, it is not related to the positions file.
Alright, I think I understand, but tell me Tony (@tonyswumac ) - how do you test your solutions in Alloy? Once you’ve already read a log file to test your Alloy pipeline, what do you do to test it a second, third time, etc. when you change your configuration and test in a test environment? I understand that Alloy remembers the offset of where it read up to, which is why removing positions.yaml didn’t work for me. I could create some bash script that constantly appends to that log file, but isn’t there something simpler? My log is generated every morning, so for the next real one I unfortunately have to wait until the next day.
Remove the positions file, and Alloy would function as a new configuration.