Prompt for a log cleanup script you can trust
Your task
Your app writes logs to /var/log/myapp, and the disk keeps filling up. You want a Bash script, run daily by cron, that deletes log files older than 30 days. You are about to ask an AI assistant to write it.
Write the prompt you would give the assistant.
What you know:
- the folder holds
.logfiles and gzipped rotations such asapp.log.3.gz - a
config/subfolder inside it must never be touched - the script runs as root
- the path will come from an environment variable,
LOG_DIR
Then, in a few sentences: which constraint matters most, and why?