<< Back

Tableau Server housekeeping made easy

*** 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.

I’ve commented what each and every line does in the script, so you can customise this to match your own requirements, then save the file with the extension “.bat” You can then run this script manually by right-clicking on the file and selecting Run as Administrator.

Edit: some of you have reported not being able to see the script here (embedded via Pastebin) due to some corporate firewall restrictions. Here is a version you can download, appended with .txt file extension.

Edit: Thanks to Andy Clapson for getting in touch and pointing out the issue with the move logs.zip command, this is now fixed!

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:

  • task scheduler setupGo 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.


Once your job is saved, you can test that it works by selecting the job in the Task Scheduler library and clicking on “Run” in the right-hand menu. (Warning here: remove the “tabadmin cleanup –restart” line from the end of the script if you’re in a live environment and you don’t want the server to go down during the test!)

Hopefully this will save all those Tableau Server admins out there some time and ensure you all have a clean and tidy Tableau Server!

Jonathan MacDonald

London, UK

18 thoughts on “Tableau Server housekeeping made easy

  1. Nice post. I manage the administration of Tableau server at my company and i’ve found using batch files and task manager extremely effective at automating tasks. I’ve automated everything from weekly back ups of the logs and server to sending several versions of different reports out on a regular cadence using a tabcmd and febootimail (one instance sends hourly reports).

    The two additional ways i have set up batch files to automate additional tasks that are helpful and worth mentioning:
    1. Creating a batch file for every time we upgrade Tableau server to repoint it to the current images for white labeling the tool. This includes the top left corner image and the one on the login page. For some reason every time we upgrade the route to the images gets dissassocited and this makes it easy.
    2. Creating a batch file to notifying all the relevant users when the server is being taken down for maintenance or is down unexpectedly.

    The back up script is definitely the most useful and something Tableau should implement as an OOTB feature.

    Thanks for sharing this, hopefully it points others in the right direction.


    1. Hi Chris,
      I’m new to the tableau and scripting, my company is planing to go-Live soon with the tableau server. I’ve seen your responses in a discussion that you are talking about automated Tableau housekeeping scripts. . I was wondering if you can able to share few of this useful automated scripts i would really appreciated that.
      Thank you,

  2. Jonathan,

    I’m trying the process that you posted here.

    During the ‘Backing up log files’ step I’m getting an error stating ‘The syntax of the command is incorrect’. It seems that the logs.zip is successfully created in my bin directory, but it doesn’t have the datestamp appended in the filename and it’s not being copied over to my backup directory. After the error, the script continues and the remaining steps complete successfully. At the end of the process I have a .tsbak file saved in my backup directory and the logs.zip file sitting in the bin directory.

      1. I had the same issue…had to enclose the file names in quotation marks: copy logs.zip “logs-%DATE:/=-%.zip”

        that worked perfectly.

  3. Thanks for the script, Jonathan. Works almost perfectly. I just have the same issue that Harley had (didn’t rename or copy). Any ideas on why? Thanks!

    1. Hi Lisa, thanks for the feedback, I’m glad you found it useful. It’s so important to clean out the logs and backup the server regularly!

      Sorry you’re having trouble with this, I haven’t seen this issue myself unfortunately, I wonder if it’s to do with the permissions on the folder you are trying to copy the logs.zip to?

      The user that runs the script must have read/write permissions on the folder you’re copying the logs.zip file to, otherwise the copy will fail.

      Failing that, feel free to pop us an email at support@theinformationlab.co.uk and I’d be happy to take a closer look.

      1. i am having same issue as Lisa has above. logs.zip file get created in /bin directory but after that it is not able to copy that zip file in a directory i created with path d:/tableaubackups/logs. Here is the script output.C:scripts>backupscript.bat
        Tue 08/25/2015 21:01:08.73: *** Housekeeping started ***
        Tue 08/25/2015 21:01:08.73: Cleaning out old log files…
        ERROR: No files found with the specified search criteria.
        Tue 08/25/2015 21:01:08.74: Backing up log files…
        The system cannot find the file specified.
        Tue 08/25/2015 21:01:13.37: Cleaning out old backup files…
        ERROR: No files found with the specified search criteria.
        Tue 08/25/2015 21:01:13.37: Backing up data…
        Tue 08/25/2015 21:02:03.28: *** Housekeeping completed ***
        D:TableauTableau Server9.0bin>

  4. Perhaps the issue with the log copy is that the logs subdirectory that is part of the destination does not exist in advance. Just a guess based on trying this today. My logs didn’t copy out of bin either. In fact, wouldn’t a move/cut be better than copy?

  5. Thank you so much for this! I was having trouble myself, because I was using a different server than the Tableau host as the backup path. The actual backup was working, but deletion of the older files was failing. The command line was throwing an UNC error when I specified the other server at \xxx.xxx.x.xxdrivefolder. I fixed this by changing the backup path to be the local directory before I deleted the old files:

    pushd %BACKUPPATH%
    forfiles -s -m *.tsbak /D -4 /C “cmd /c del @path”

  6. I am trying to automate a similar set of scripts but have a different issue that I am hoping someone else has already work through. I created a batch file that reads as below. I can run it manually (CMD) but when I try to schedule it I get a scheduler error “Action Failed to start” With a ResultCode 2147943140.
    My suspicion is the user admin rights are not set up completely correctly. Any suggestions would be appreciated.

    C:\Program Files\Tableau\Tableau Server\9.3\bin\tabadmin” ziplogs -l -n -f
    copy logs.zip C:\TableauBackup\logs.zip
    REM tabadmin backup C:\TableauBackup\TableauSnapshot.tsbak -d
    “C:\Program Files\Tableau\Tableau Server\9.3\bin\tabadmin” backup C:\TableauBackup\TableauSnapshot.tsbak

    REM Tier3 storage log & backup rotation pipe dream
    REM copy C:\TableauBackup\TableauSnapshot.tsbak J:\TableauBackup

    REM Run tableau cleanup with restart
    “C:\Program Files\Tableau\Tableau Server\9.3\bin\tabadmin” cleanup –restart

    1. Hi Jason, your suspicion is likely correct. If the script works when you run it manually then it’ll be a permissions issue with Task Scheduler. Are you running Task Scheduler as administrator (right-click, run as)? Also make sure the user that you have specified to run the task has local admin rights, and that you tick the ‘run with highest privileges’ checkbox. Hope that helps!

  7. Hi Jonathan. Thank you for the script. I can get it to run correctly from the command prompt. However, when I schedule it with task scheduler it never completes – it stays at a “Running” status for hours and nothing ever happens. Any ideas on how to solve this?

  8. I too had to rework the move command that other users have commented on. I used the full qualified name at line 50 (below) and it worked. Not sure why.
    move logs.zip “C:\Program Files\Tableau\Logs\logs-%SAVESTAMP%.zip”

  9. Thank so much for these scripts. They have been a life-saver after moving to Tableau Server 2018.x.x.
    For anyone creating Scheduled tasks in windows, I created a conditional scheduled task for the cleanup logs that runs after the Zip Logs task.

    1) Create .cmd file to call script for for the log-archive and server-cleanup (Don’t run)
    call D:\Tableau\tableau-server-log-archive-script.cmd -u .\LocalUser -p **pwd** -d 28
    Do also for the cleanup script.

    2) Create task named “Tableau Zip Logs” that points to your cmd file that calls the script.
    3) Create task named “Tableau Log Clean Conditional” (Name not important), but the trigger must be a Custom XML with the following code.

    [@Name=’TaskSuccessEvent’][Data[@Name=’TaskName’]=’\Tableau Zip Logs’]]

    You first create this task with a normal trigger, then go back into the properties, and Select the Triggers Tab, Delete the Monthly Trigger, and select New, in the For Begin the task: field select On an Event. Select Custom, Then New Even Filter.
    When the New Event Filter windows appears, select the XML Tab, Click Edit query manually, answer yes to the warning. Paste the following above code.

Leave a Reply

Your email address will not be published. Required fields are marked *