There is no way to clear the event log for a Node

Bug #1403080 reported by Graham Binns
28
This bug affects 4 people
Affects Status Importance Assigned to Milestone
MAAS
Invalid
Wishlist
Unassigned
maas-ui
Fix Released
Unknown

Bug Description

See bug 1402237. It's possible for a Node to have tens of thousands of event log entries, but there's no way for a user to dispose of them should they no longer be needed.

tags: added: oil
Revision history for this message
Jason Hobbs (jason-hobbs) wrote :

These days, even trying to delete them with a manual SQL statement doesn't work. I tried this query, let it run for 90 minutes and then gave up:

maasdb=# delete from maasserver_event where id < 6000000;
^CCancel request sent
ERROR: canceling statement due to user request
CONTEXT: SQL statement "SELECT pg_notify('event_delete',CAST(OLD.id AS text))"
PL/pgSQL function event_delete_notify() line 4 at PERFORM

It takes about 20 seconds to delete 50k records.

Revision history for this message
Gavin Panella (allenap) wrote :

A couple of workarounds:

-- The nuclear option:
TRUNCATE TABLE maasserver_event;

-- A slightly nicer option:
ALTER TABLE maasserver_event DISABLE TRIGGER maasserver_event_event_delete_notify;
DELETE FROM maasserver_event WHERE id < 6000000;
ALTER TABLE maasserver_event ENABLE TRIGGER maasserver_event_event_delete_notify;

I'm not sure we actually want this trigger to be there; it's
automatically created to keep the UI up to date. For the event log I
think we could dispense with tracking DELETE.

Revision history for this message
Blake Rouse (blake-rouse) wrote : Re: [Bug 1403080] Re: There is no way to clear the event log for a Node

Yeah we could get ride of that trigger, true its probably not needed. Jason
that trigger would have really slowed that operation down.
On Apr 21, 2015 5:15 PM, "Gavin Panella" <email address hidden>
wrote:

> A couple of workarounds:
>
> -- The nuclear option:
> TRUNCATE TABLE maasserver_event;
>
> -- A slightly nicer option:
> ALTER TABLE maasserver_event DISABLE TRIGGER
> maasserver_event_event_delete_notify;
> DELETE FROM maasserver_event WHERE id < 6000000;
> ALTER TABLE maasserver_event ENABLE TRIGGER
> maasserver_event_event_delete_notify;
>
> I'm not sure we actually want this trigger to be there; it's
> automatically created to keep the UI up to date. For the event log I
> think we could dispense with tracking DELETE.
>
> --
> You received this bug notification because you are subscribed to MAAS.
> https://bugs.launchpad.net/bugs/1403080
>
> Title:
> There is no way to clear the event log for a Node
>
> Status in MAAS:
> Triaged
>
> Bug description:
> See bug 1402237. It's possible for a Node to have tens of thousands of
> event log entries, but there's no way for a user to dispose of them
> should they no longer be needed.
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/maas/+bug/1403080/+subscriptions
>

Changed in maas:
milestone: none → next
Revision history for this message
Jeff Lane  (bladernr) wrote :

I see this now marked to Next... how soon is Next?

I have a node that has currently about 6000 log entries and the UI sometimes freezes trying to load them all (it loads for at least the last 30 days).

I want clear these items completely without resorting to SQL queries run on the maas server.

Revision history for this message
Andres Rodriguez (andreserl) wrote :

Hi!

We believe this is no longer an issue in the latest MAAS releases. As such, we are marking this bug report as invalid. If you believe this is still an issue, please re-open this bug report.

Thanks

Changed in maas:
status: Triaged → Invalid
Changed in maas:
status: Invalid → Triaged
importance: Medium → High
no longer affects: maas-ui
Changed in maas-ui:
status: Unknown → New
Revision history for this message
Igor Gnip (igorgnip) wrote :

just deleting events older than last date you might be interested in works fine and in maas 2.7 provides really noticeable performance improvement;

delete from maasserver_event where updated < '2021-01-01'

we could really have an option in ui to clean manually or to specify how long to keep events.

Revision history for this message
Igor Gnip (igorgnip) wrote :

this one also to cleanup events for nodes which are deleted from maas (leftover events cleanup)
delete from maasserver_event where node_system_id not in (select system_id from maasserver_node where system_id = node_system_id);

Revision history for this message
Jerzy Husakowski (jhusakowski) wrote :

This is related to retention policy feature request. This will be picked up as part of MAAS roadmap, no specific implementation date can be given now.

Changed in maas:
importance: High → Wishlist
milestone: next → none
Revision history for this message
Jerzy Husakowski (jhusakowski) wrote :

The feature landed on MAAS backlog for further prioritisation

tags: removed: oil ui
Changed in maas:
status: Triaged → Invalid
Changed in maas-ui:
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.