[THIN] Re: Reduce the Appsense Event Retention?

  • From: Ben Pelzer <Ben.Pelzer@xxxxxxxxxxx>
  • To: "thin@xxxxxxxxxxxxx" <thin@xxxxxxxxxxxxx>
  • Date: Mon, 1 Aug 2011 10:18:13 +0200

Hi James,

You can not do that from within the Management Console (yet) as far as I
You'll have to delete the events by hand

I was in the same "predicament" as you, the SQL database my customer used
for the AppSense Management server even filled up completely (that will
teach them to use SQL Express)
So I asked AppSense support about this and they provided me with a SQL
script to delete all events past a certain date to purge the database and
free up some space
For good measure I'll copy the mail and the script I got from them in here
The script can be used to make some kind of recurring scheduled task
Hope you can use this too



-----Begin mail from AppSense Support
Hello Ben, 

As mentioned in my previous email, please find a sql script attached (you
will need to save and remove the .txt extension)

There are two edits required to the file, line 2 requires the name of the
database to be entered, and line 6 requires the number of days that events
should be kept. All events older than this value will be deleted. This
needs to be run from the SQL Server Management Studio, or from the command
line using osql.exe.

Also, as mentioned in my previous email, before running this I would
suggest stopping the "AppSense Events Dispatcher Service" which will
prevent any more events being added to the database while the script runs,
and will also allow time to check the database size afterwards and remove
any packages, or older versions of, if more space is required.

Once you are happy with the database size, restart the "AppSense Events
Dispatcher Service". I would suggest at this point keeping a close eye on
the database size and check your event filtering configuration. I would
also suggest implementing some form of monitoring so you can be alerted
when the database is getting large.
 If you still require a lot of auditing information, I would suggest
moving the database to a SQL Server, instead of SQL Express.

Please do not hesitate to contact me should you have any issues or queries
with the above.
-----End mail

-----Begin SQL script, select and copy into a text file and rename it to
.sql extension; run on SQL server that holds AppSense database

-- Set the following to the database that this script operates on
USE [DatabaseName]

-- This represents the number of days to preserve events for
-- i.e. '7' will delete events older than one week
DECLARE @ageOfEvents INT
SET @ageOfEvents = 7

-- Delete the events
DECLARE @eventCount INT
SET @oldestEventTime = DATEADD (DD, -@ageOfEvents, GETUTCDATE())
PRINT N'Deleting events older than ' + CONVERT(NVARCHAR(32),
EXEC Event_DeleteFromTime NULL, @oldestEventTime, 0, @eventCount OUTPUT
PRINT CONVERT(NVARCHAR(12), @eventCount) + N' events deleted'

-----End SQL script

On 30-07-2011 00:58 , "thin-digest@xxxxxxxxxxxxx"
<thin-digest@xxxxxxxxxxxxx> wrote:

>Msg: #4 in digest
>Subject: [THIN] Reduce the Appsense Event Retention?
>Date: Fri, 29 Jul 2011 17:01:44 +0100
>From: "James Scanlon" <James.Scanlon@xxxxxxxxxxxxxxxx>
>Any one know how to set APPSENSE event retention?
>We have specific events 'captures' enabled - but the retention on these
>events is from when Appsense was running.
>We only want to keep the last 2 weeks worth of logs / events? Can this
>easily be set anywhere?
>Cheers :)

For Archives, RSS, to Unsubscribe, Subscribe or
set Digest or Vacation mode use the below link:

Other related posts: