You are not logged in.

Announcement

 Téléchargez la dernière version stable de GLPI      -     Et vous, que pouvez vous faire pour le projet GLPI ? :  Contribuer
 Download last stable version of GLPI                      -     What can you do for GLPI ? :  Contribute

#1 2023-02-15 11:53:54

It_from_med
Member
Registered: 2022-01-25
Posts: 10

clean glpi_logs

Hello everyone,

I'm trying to figure out how I can clear the glpi_logs table.
Since the update of my GLPI in 9.5 I cannot play the migration GLPI commands only on this table.
I get errors "The total number of locks exceeds the lock table size" so I would like to reduce the table.
I saw that there was a cleanhistory.php but it is not in the tools in the repo anymore.

If you have any idea i'm in! Thanks

Offline

#2 2023-03-21 17:07:53

Michel Karwatka
Member
Registered: 2015-04-08
Posts: 59

Re: clean glpi_logs

Hello,
here below translation (with Google translate) of the answer I gave in french in another post of this forum.
Hope it will help you.



HELLO,
I had the same problem with a glpi-logs table that reached 140GB!
I managed to solve this a number of times using a command line to launch on the server from the Front directory in your GLPI website.
Here is the command: php cron.php --force PurgeLogs
Please note that lower and upper case letters must be respected in the last parameter.

Before doing this you must go to Settings > General > Purge history and modify one of the settings that allow you to delete part of the history.
Personally all the parameters were at "Delete if older than 12 month" and I decided to start with the "Components / Add a component" parameter by selecting the value "Delete if older than 11 month".
I advise you not to change too many parameters at once. By removing a month, the "purgelogs" took at least between 7 and 10 hours.
Once you have saved the changes you made, you can run the above command.

Attention ! Just because the "purgelogs" command has run doesn't mean you'll see a difference in the glpi_logs table.
It is still necessary to launch an optimization of the glpi-logs table with a tool like Navicat. There is a special version for MariaDB.
You can run the PHP command above several times and then just run the optimization.
Depending on the size of your glpi-logs table, the optimization can also take several hours.

Last thing, while you launch the deletion of entries in the glpi-logs table, remember to modify the "log level" parameter in Configuration > General > System to a smaller value (personally I put 1) otherwise GLPI will continue to fill the glpi-logs table while you work hard to empty it.

I wish you good luck. It takes time but in my GLPI I managed to reduce the size of the glpi-logs table from 140GB to 5MB!

Offline

Board footer

Powered by FluxBB