Deletion of old output files

my logstash is outputing logs in files to then be ingested by elastic agent.
In order to not have huge amount of disk being consumed by logs, I would like to rotate logs and then delete the old ones (after 3 day).

I can used this for the daily rotation:
path => "./test-%{+YYYY-MM-dd}.txt

but how can I delete the old ones?
thank you

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.