How to Clean Logs and Reboot a Sensor Registered to Pulse
For each week a sensor remains online various system logs will grow in size in addition to the log files specific to the Pulse related services. Whereas there is no method presently in use to purge (clean) log files, a sensor being online for a lengthy period of time (i.e. year or more) could inevitably encounter an issue with a lack of drive space leading to services stopping or the sensor abending.
The following script when run as a Script/Task within Pulse on weekly basis has proven useful to remove log files and to ensure the sensor does not encounter an issue involving a lack of drive space. Additionally the sensor will be rebooted upon conclusion of the script running.
#!/bin/bash systemctl stop pwnscan systemctl stop pwnix_realtime_wireless systemctl stop pwnix_kismet_server systemctl stop blue_hydra systemctl stop openvas-manager systemctl stop openvas-scanner journalctl --vacuum-size=100M > /var/log/daemon.log > /var/log/syslog > /var/log/messages rm -f /var/log/exim4/*.gz rm -f /var/log/nginx/*.gz rm -f /var/log/pwnix/passive_recon/* rm -f /var/log/pwnix/* rm -f /var/log/*.gz rm -f /var/log/*.0 rm -f /var/log/*.1 rm -f /var/log/*.2 rm -f /var/log/*.3 rm -f /var/log/*.4 rm -f /var/log/*.5 rm -f /var/log/*.6 rm -f /var/log/*.7 rm -f /var/log/*.8 rm -f /var/log/*.9 sleep 3 reboot
Copyright
© 2024 Outpost24® All rights reserved. This document may only be redistributed unedited and unaltered. This document may be cited and referenced only if clearly crediting Outpost24® and this document as the source. Any other reproduction and redistribution in print or electronically is strictly prohibited without explicit permission.
Trademark
Outpost24® and OUTSCAN™ are trademarks of Outpost24® and its affiliated companies. All other brand names, product names or trademarks belong to their respective owners.