Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix purging of log files #47

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

helioz2000
Copy link
Contributor

Line 45 comment indicates files to be purged if they are older than 2 days. According to "man find" the option "-mtime +1" will provide this functionality (see "-atime" example in "man find").

Line 45 comment indicates files to be purged if they are older than 2 days. According to "man find" the option "-mtime +1" will provide this functionality (see "-atime" example in "man find").
@MW0MWZ
Copy link
Collaborator

MW0MWZ commented Nov 9, 2021

Did you check to see if this is working? Remember that this is operating along side of log rotate too.

@helioz2000
Copy link
Contributor Author

helioz2000 commented Nov 11, 2021

@MW0MWZ - As far as I can ascertain logrotate is not affecting any files in /var/log/pi-star/ .
Please correct me if I'm wrong but if logrotate was to handle any pi-star log files I'd expect /etc/logrotate.d/ to contain a pi-star config entry.
As far as I can see, /usr/local/sbin/pistar-daily.cron is the only script which handles log files located in /var/log/pi-star/. I also note that the same script removes all files in /var/log/ - these log files are handled by /etc/logroate.d/rsyslog which compresses and rotates them daily, keeping 2 copies before deleting. However, /usr/local/sbin/pistar-daily.cron will actually delete those files and therefore render logrotate useless for /var/log/.
The above analysis is a bit more complex than the intent of this pull request .... I was simply referring to the mismatch between the comment line ("Purge the logs older than 2 days") and the "-mtime +0" parameter. man page for find states "-mtime +1" results in files modified more than 2 days ago (as explained under -atime).
It comes down to the intent of pi-star log file handling .... the way it currently works (-mtime +0) will leave the "current" log file (the one that's being written to by the process) and one completed log (old) file, any files before that are deleted.
Whereas "-mtime +1" will leave 2 completed log files in addition to the current log file.

IMHO logrotate would be a more flexibility solution for pi-star log files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants