25 July 2014
*** An updated version of this post for Tableau Server v2018.2 and later can be found here: https://www.theinformationlab.co.uk/2018/08/28/updated-tableau-server-housekeeping-made-easy-windows-edition/ The best thing about administering Tableau Server is its self-sufficiency - the server manages its memory pretty well, processes that die are automatically respawned, and monitoring tools are already built-in via the administration dashboards. While this is all good stuff, Tableau Server does require a bit of housekeeping to keep the server clean, secure and backed up. Left on its own, a Tableau Server will quickly accumulate hundreds of MB in log files and leave your install at risk with no automatic backup processes in place.In this article I’ll show you a handy script and some instructions for scheduling this script that will take the guesswork out of your Server housekeeping tasks, but before you start zipping and backing up everything, you need to give some thought to your backup and logfile rotation strategy. How many backup files should you keep? How long should we save our old log files for?
A note on backup and logfile rotation strategy
How often you backup, when you backup and how many backups you store will largely depend on your business needs, but I would recommend always storing at least two backup files, just in case one of the files becomes corrupted. You may want to store more backup files, but keep in mind that the backup file contains all the data on your server, so it could end up being quite large and you’ll need to make sure you have plenty of storage. A conservative recommendation would be to take one nightly backup and one weekly backup, storing only the most recent night’s backup and two weeks’ worth of weekly backups.Attitudes towards log files vary, but I would recommend you clean up your logs once a week to avoid them growing too large. Keeping copies of old logs can come in handy if you need to investigate an issue and analyse historical log files, or raise a ticket with Tableau Support. A good recommendation is to clean out your logs weekly, storing four weeks of zipped log files.Creating a tabadmin batch script
So let’s say we want to put this strategy into action. We can achieve this with a batch script, that will execute the following commands:- Compress the current logfiles into a zip file
- Backup the tableau server config and data
- Clean up the live logs once you've zipped the old ones
- Append the date to both the zipped logs and the backups
- Delete old backups and zipped log files beyond a certain age, according to the strategy you agree above.
Automating the script
To schedule this you can use any number of enterprise job scheduling tools, but for this example we're going to use Windows Task Scheduler:Go to Start and type in 'task scheduler'. Be sure to right-click and run it as administrator, or your job may not run.
- In Task Scheduler, click on Create task in the right-hand menu and give your task a name, e.g. weekly tableau housekeeping.
- You then want to change the 'run as' user or group to match your Tableau run as user account, then be sure to tick to the 'Run whether user is logged in or not', and 'Run with highest privileges' options.
- Then go to the triggers tab and set your schedule, and the actions tab to choose your script file to run.