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!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
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.
Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.
