Deleting Old FileWave Client or Server Log Data
Description
FileWave stores many different types of logs. Many of these logs are designed to roll over, either to new files or by removing older entries. In the majority case, FileWave logs do not store data with GDPR concern, however it is possible that files could be populated with such information, some depending upon use.
Although many log files do roll over, it is possible that log files may become very large. Since this can be possible and GDPR could be of concern, it may be desirable to remove older log data.
The following provision is designed to remove all log data older than a defined period in days.
Information
The scripts provided will archive the current log files into a locally stored zip file. On completion the active log files will be emptied. This will occur on a regular basis as defined by a variable. On each subsequent execution, a new zip of the current logs will be created and the old zip will be removed.
Log duration should not be too short. When the logs are archived and the active logs emptied, the archive is the only backup of those original logs. Since only the latest zip is kept, all old log entries (as intended) will no longer be available.
The zip file could be copied to a more secure location for a greater amount of history. Consider doing this will the same frequency as the amount of days being kept.
If the chosen amount of time is 10 days, this will provide up to a maximum of 19 to 20 days worth of logs. 10 days within the zip and the next 9 to 10 days of active logs before the script re-runs.
Directions
FileWave Server
By default, the following script will run in a 'Dry Run' mode, only showing the files that would be zipped. No files will actually be zipped and the original files will remain untouched.
Download: server_log_archiver.sh.zip
The script has the following flags:
Usage
Optional:
-d Integer specifying the amount of log days to keep (default 10 days)]
-c [Add the script to cron]
-a [Action the script. Dry run if this option is not specified. Dry run will echo only]
Options
'-d'
If this option is not supplied, the amount of days to keep will be set as 10. Use this option to specify an alternative amount of days to keep. For example, to set this as 7 days:
sudo ./server_log_archiver.sh -a -d 7
'-a'
This option will overrule the Dry Run mode and all files will be zipped and all defined, active logs emptied.
'-c'
This option will add the script to the cronjobs list. There is no need to specify '-a' when using this option, this will automatically occur. However, '-d' may still be used to specify the desired amount of days to keep. Place the script at a desirable location and then run the script with this option.
For example, to add this as a cronjob, specifying 14 days and with the script located in /root/ the following would be entered.:
sudo /root/server_log_archiver.sh -d 14 -c
The zipped archive 'filewave_logs.zip' will be stored in the following directory:
/private/var/log/fwxserver_log_archive/
If this script is used on a FileWave Server and FileWave team members request logs, it may be necessary to provide the zip along with any requested log files, for completeness.
macOS Client
The macOS Script potentially handles both the FileWave Client logs and FileWave Central logs.
Download: client_log_archiver.sh.zip
By default, the following script will run in a 'Dry Run' mode, only showing the files that would be zipped. No files will actually be zipped and the original files will remain untouched. The script has the following flags:
Usage
Files included for archive will be not only zipped, but original files will be emptied.
Optional:
-a [Action the script. Action a dry run if this option is not specified. Dry run will echo only]
-d [Integer specifying the amount of log days to keep (default 10 days)]
-e [Start from the beginning. The zip will be erased and the script will run as if first ran]
-f [Archive Fileset logs from client as well as generic FileWave Client logs. -g is uneccessary when running this option]
-g [Archive generic FileWave Client logs (not including Fileset logs). Fileset logs will remain as is.]
-r [Rerun the script, but keep zip archive. Current zip will be presevered and only additional logs included from the above options will be added to the archive if not already zipped]
-s [Archive FileWave Central logs from computer]
-x [This options will zip all client logs (same as running -f) and also action the script]
Options
'-a'
This option will overrule the Dry Run mode and all files will be zipped and all defined, active logs emptied.
'-d'
If this option is not supplied, the amount of days to keep will be set as 10. Use this option to specify an alternate amount of days to keep. For example, to set this as 7 days:
sudo ./client_log_archiver.sh -a -d 7
'-e'
This option will remove the current zip and act as if this is the first time the script ran. If this option is not set, any re-running of the script will add or update the current contents of the zip.
If the script is ran again, shortly after running the script initially, the archive will only contain a minimum amount of data, since the last zip of logs.
'-r'
It may be desirable to re-run the script to add logs not previously included, whilst preserving the current zip. The '-r' option allows for just that situation.
'-x'
Running '-x' is the same as setting both '-a' and '-f' simultaneously.
The next options determine which logs are archived. '-f' and '-g' should not be used at the same time, since '-f' will overrule '-g'.
'-f'
Zip and replace all FileWave Client Logs. This will include all generated log files from Filesets, e.g. script logs.
'-g'
The '-g' option zips and replaces all FileWave Client Logs, excluding Fileset logs. Since Fileset scripts are written by the administrator of FileWave, the contents of those scripts can be controlled and contents known. As such, it may be desirable to keep these logs.
'-s'
This last option will zip and replace any logs generated by the FileWave Central application. This option need only be set on computers which run this application.
Examples
To archive only FileWave Central logs:
sudo ./client_log_archiver.sh -a -s
Zip FileWave Client, excluding Fileset logs:
sudo ./client_log_archiver.sh -a -g
If after running the above command the following were to be actioned, the zip would be updated to include Fileset logs, but the other, already zipped Client logs would be left as is:
sudo ./client_log_archiver.sh -a -r -f
Fileset Contents
The script needs to run with the client stopped. As such, the script cannot be ran through FileWave. Instead, the Fileset includes a LaunchDaemon to handle the periodic running of the script, as well as the script itself.
If this script is used on FileWave Clients and FileWave team members request logs, it may be necessary to provide the zip along with any requested log files, for completeness.
No Comments