Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
TKendrick20
Partner - Specialist
Partner - Specialist

Automatically Purge Qlik Sense Server Archived Log Files?

I've had a Qlik Sense Server up and running for a couple years now. However, every once in awhile I need to go clear out the archived log files located at the path C:/Qlik/Sense/Repository/Archived Logs/[server name]/Scripts

The machine that runs my Qlik Sense Server only has 126GB storage and these logs are currently taking up 94GB of space which is a little obnoxious.

I have two questions:

  1. What are these files even used for? (Is it bad that I just deleted most of them?)
  2. Is there a way I can schedule a task so that it clears these out every month? or Can I set a expiration date on these files so it only keeps the past 30 days?
1 Solution

Accepted Solutions
kevincase
Creator II
Creator II

Tim,

I just created a batch job that moved the files to an archive folder.  It also cleans out old logs from the archive that are older than 31 days.  You could adjust the purging from the archive folder to a shorter time if space is an issue.

Here is the script I use.

MOVE c:\ProgramData\Qlik\Sense\Log\Script\*.* "F:\Log Archive\"

MOVE "C:\ProgramData\Qlik\Sense\Repository\Archived Logs\server_name\Script\*.*" "F:\Log Archive\"

Forfiles /P "F:\Log Archive" /M *.log /D -31 /C "cmd /c del @file /q"

1.  It moved the script logs to the Log Archive folder on F

2.  move all archived logs to the Log Archive folder on F

3.  Delete files from the Log Archive folder that are older than 31 days.

I have a scheduled task that runs once a week.  That allows me to keep Qlik's archived logs intact for the week and also gives me roughly a months work of older logs.

If your Operation and License monitors are running on a regular basis, you really don't need to keep the logs.

Hope this helps.

Kevin

View solution in original post

3 Replies
kevincase
Creator II
Creator II

Tim,

I just created a batch job that moved the files to an archive folder.  It also cleans out old logs from the archive that are older than 31 days.  You could adjust the purging from the archive folder to a shorter time if space is an issue.

Here is the script I use.

MOVE c:\ProgramData\Qlik\Sense\Log\Script\*.* "F:\Log Archive\"

MOVE "C:\ProgramData\Qlik\Sense\Repository\Archived Logs\server_name\Script\*.*" "F:\Log Archive\"

Forfiles /P "F:\Log Archive" /M *.log /D -31 /C "cmd /c del @file /q"

1.  It moved the script logs to the Log Archive folder on F

2.  move all archived logs to the Log Archive folder on F

3.  Delete files from the Log Archive folder that are older than 31 days.

I have a scheduled task that runs once a week.  That allows me to keep Qlik's archived logs intact for the week and also gives me roughly a months work of older logs.

If your Operation and License monitors are running on a regular basis, you really don't need to keep the logs.

Hope this helps.

Kevin

jpjust
Specialist
Specialist

Hi,

I have multiple folders under Archive drive such as Engine,Proxy,Repository,Scheduler,Script and few others.

And under Engine, there are again multiple folders such as Audit, System, Trace

So my script will be as follows for "ENGINE"

Forfiles /P "D:\QlikSense\ArchivedLogs\servername\Engine\Audit" /M *.log /D -30 /C "cmd /c del @file /q  

Forfiles /P "D:\QlikSense\ArchivedLogs\servername\Engine\System" /M *.log /D -30 /C "cmd /c del @file /q  

Forfiles /P "D:\QlikSense\ArchivedLogs\servername\Engine\Trace" /M *.log /D -30 /C "cmd /c del @file /q  

Similarly, I will have scripts for Proxy, Repository folders etc.,

Then have all the scripts into an .bat file and run once a week using windows task scheduler.

Is this the best approach?

Thanks

 

twales
Contributor III
Contributor III

We have FISMA requirements to retain logs, therefore I do a similar purge post archiving(not the Qlik archive).  The dev server I purge both the active logs and archive logs on a  90 day retention for active and 30 day  for archive.

The best approach is to use the /S and all sub directories will be search recursively starting at your /P top of tree directory. You can cover all log files and directories like below for active logs in your scheduled batch and do the same for archives in 2 lines, 1 batch.

forfiles /P C:\ProgramData\Qlik\Sense\Log /S /M *.log /D -90 /C "cmd /c del /f /q @path"

Note this is an example your purge of only .log files.  You can also do one loop and recursively search all sub dirs and files w/o using forfiles and control more granularity of what's deleted.