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 themost majority case,cases, FileWave logs do not store dataGDPR-sensitive withdata, GDPRbut concern,some howeverenvironments itor isscripts possiblecan write information that files couldshould be populatedretained withonly suchas information,long someas depending upon use.needed.
Although manyMany log files dorotate rollautomatically, over,but itthey iscan possible that log files maystill become verylarge large.or Sinceexceed thisyour canretention bepolicy. possibleIn those cases, archive and GDPR could be of concern, it may be desirable to removeclear older log data.data deliberately.
The followingattached provisionscripts is designed to remove allarchive log data older thanon a defined periodschedule inand days.keep only the newest archive by default.
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 doingcopying thisthe willarchive on the same frequencycadence as the amountnumber of days beingyou kept.keep.
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,cron specifyingjob 14with daysa 14-day retention period and with the script located in /root/, the following would be entered.:run:
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 forin the archive will be not only zipped, butand the original log 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 the client as well as generic FileWave Client logs. -g is uneccessaryunnecessary 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 the zip archive. Current zip will be preseveredpreserved 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 ranrun again,again shortly after running the scriptfirst initially,run, the archive will only contain alogs minimum amount of data,created since the lastprevious zip of logs.zip.
'-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 withwhile the client stopped.is Asstopped, such,so the scriptit cannot be ranrun directly through FileWave. Instead, the Fileset includes the script and a LaunchDaemon to handlerun theit periodic running of the script, as well as the script itself.periodically.
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.