I want to enforce strict privacy rules on my LEMP droplet and look for a way to automatically delete all log files that include my visitors data (IP address etc.) after a 24h period?
P.S.: I found a way to completely turn off IP logging but then fail2ban can’t protect my droplet anymore, so a 24h logging period seems like a good compromise.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
This question was answered by @brass:
I would set up a cron job to run every 24 hours to delete the logs, access and error logs.
find /var/log/nginx/* -mtime +1 -exec rm -rf {} \;If you type that into your terminal, you can test the command out first. If it works like you want, it will remove all of the files in that folder older than 1 day, then set up a cron job to run every 24 hours.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.