Anonymous_User Absent Member.
Absent Member.
473 views

sql query to remove events older than x days


I am looking for a query to remove orphaned events from the QDB that are
older than x days old. Can someone assist me with this?

Thanks,

Dale


--
ddowden
------------------------------------------------------------------------
ddowden's Profile: https://forums.netiq.com/member.php?userid=8844
View this thread: https://forums.netiq.com/showthread.php?t=52538

0 Likes
3 Replies
Anonymous_User Absent Member.
Absent Member.

Re: sql query to remove events older than x days


Hi Dale

I may be able to help but when you say remove, do you wish to delete or
close the Events, and can you clarify what you mean by orphaned - is it
that the associated Job has been deleted?


--
Alain Salesse | Senior Technology Consultant | Alain.Salesse@NetIQ.com
------------------------------------------------------------------------
SalesseA's Profile: https://forums.netiq.com/member.php?userid=3958
View this thread: https://forums.netiq.com/showthread.php?t=52538

0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: sql query to remove events older than x days


It's not quite as simple as a query to remove those events - when an
event is closed/acknowledged/deleted, it is processed to update things
like parent event counters and the "flashing icon" in the treeview. For
example, getting rid of a severe open event after 10 days means having
to change the "owner" to make sure it no longer has a red icon...
..
In the past we had an "unsupported" utility called AutoAgeEvents that
would ensure this processing happened. You can see reference to it here
(in terms of updating to be used in AM8)

https://forums.netiq.com/archive/index.php/t-46904.html

But remember that it is still unsupported...

Have you looked at Archiving of events? The settings that control this
(accessed via the OC) will allow you to specify events to be archived
after X days and then deleted from the archive tables after Y days. That
might do what you want? And is supported...


--
Andy Doran
Software Engineer Consultant (NetIQ)
------------------------------------------------------------------------
andy_doran's Profile: https://forums.netiq.com/member.php?userid=3937
View this thread: https://forums.netiq.com/showthread.php?t=52538

0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: sql query to remove events older than x days


Here is a stored procedure you can use to close Events based on their
age and occurrence. Install the script by executing it in the AppManager
Repository, then you can execute it as follows:

Exec _CloseEventsByAgeAndCount @DAYSOLD, @EVENTCOUNT,
@COMMENT_ON_CLOSE, @STATECHANGE, @TEST_MODE

*@DAYSOLD *- the minimum age of the Events to be closed
*@EVENTCOUNT* - the minimum number of times the Event has occurred.
Specify 1 for all Events.
*@COMMENT_ON_CLOSE* - specify 1 to add a comment to the Event stating
why it was closed, or 0 to not add a comment.

*@STATECHANGE* - optional. By default the procedure will not close an
Event if its associated Job has the "State Change" feature enabled as
this could mask issues for long periods. To close an Event even if State
Change is enabled then specify 0.
*@TEST_MODE* - optional. Specify a value of 1 to run the procedure in
test mode where it will list what will be closed but without actually
closing it.

For example, to close Open and Acknowledged Events 5 days or older that
occurred once or more and set a comment:
Exec _CloseEventsByAgeAndCount 5, 1, 1


+----------------------------------------------------------------------+
|Filename: CloseEventsByAgeAndCount.txt |
|Download: https://forums.netiq.com/attachment.php?attachmentid=242 |
+----------------------------------------------------------------------+

--
Alain Salesse | Senior Technology Consultant | Alain.Salesse@NetIQ.com
------------------------------------------------------------------------
SalesseA's Profile: https://forums.netiq.com/member.php?userid=3958
View this thread: https://forums.netiq.com/showthread.php?t=52538

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.