Delete unwanted entries from admin diary

How To

Delete unwanted entries from admin diary


Applicable on the server on which the Admin Diary Backend, introduced with UCS 4.4. is installed.

This HowTo explains how to remove the complete messagegroup “User {username} modified”, e.g. because it has flooded the diary due to a bug. The procedure is abstractable to other message groups.

A useful Cheatsheet for psql

Step 1

Login to the server, on which the AdminDiary Backend is installed as user root.

Step 2

Switch to the user context of the user postgres:
root@<admin-diary-backend-host>:~# su - postgres

Step 3

Open the psql shell as user postgres (Attention: this is the root user of the database!):
postgres@main:~$ psql -U postgres

Step 4

Connect to admindiary database:
postgres=# \c admindiary

Step 5

Find event_id of the messagegroup (in our example “User {username} modified”) to be deleted:
admindiary=# select * from event_messages where message like ‘User%modified’;

Search for the unwanted message. You can limit or extend the result by adjusting the Like specification.
Remember the event_id in the first column. In our example it is 345. You may need to exchange this with your event_id!

Step 6

Before we delete, we check that only the unwanted entries are returned:
admindiary=# select * from entries where event_id = 345;

Step 7

Check individual entries randomly on the basis of time to see whether they are the unwanted entries. You can also implement additional filters, for example, if the unwanted entries all come from the user cn=admin and the entries should be retained by the user administrator:
admindiary=# select * from entries where event_id = 345 and username = ‘cn=admin’;

Step 8

If you are sure you have only filtered the right entries, you can delete the entries with:
admindiary=# delete from entries where event_id = 345;

Step 9

Quit the psql session with:
admindiary=# \q