Insert into log failed... in simple terms!

Insert into log failed... in simple terms!

by Mary Cooch -
Number of replies: 10
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators
OK I have done a search and I know this is a recurring problem and is in the tracker-

twice today for the first time I got this message on a Moodle I look after (1.9.3)
Insert into log table failed at Thursday 08th of January 2009 10:39:27 AM.
It is possible that your disk is full.

The failed SQL is:

INSERT INTO mdl_log (time, userid, course, ip, module, cmid, action, url, info)
VALUES ('1231432767', '355', '88', '10.134.67.26', 'course', '0', 'enrol', 'view.php?id=88', '88')


My problem is- I cannot understand the solutions sad There has been no major uploading of large files/no increased activity so I don't believe the disk is full.

I do have full access to the files/database/ etc, so if someone could just point me in the right direction please?
Average of ratings: -
In reply to Mary Cooch

Re: Insert into log failed... in simple terms!

by John White -
Hi Mary

HNY 2009!

I have read some useful comments on this from Amr Hourani (no doubt you have found those too).

On that basis I think the first thing to do is enter phpMyAdmin (probably via cPanel)
- assuming that you are on MySQL (not a Microsoft MSSQL Server) and open the table mdl_log.

If you click the Browse tab, does it show 30 rows, but report many THOUSANDS?

Now click the SQL tab above the table contents and paste in...

SHOW TABLE STATUS LIKE 'mdl_log';

(note that THIS command seems to require the trailing ; when many others don't!)

You should get something like the attached... but is your Data_length huge?
Approaching the max_data_length?
Is Data_free very low?
Is Auto_increment huge?

If this is the case you should either be able to force the table to allow more that 4 GB space (as Amr suggests), or copy relatively recent logs into a new table mdl_log_old and then TRUNCATE this one, automatically deleting all its contents and resetting autoincrement to 1. If you need more on this, just say so.

If the size of the log file has become a problem then you probably have the default setting 'Never delete logs' in Site Administration->Server->Cleanup, and frankly you could just reconsider the worth of this position! Changing this setting and then waiting for cron to do its work (I presume) might be all that's needed anyway!

Hope something here helps.

Regards,
John

PS: If your log file is not huge, then the above could all be a red herring!!!
Attachment log_status.jpg
Average of ratings: Useful (1)
In reply to John White

Re: Insert into log failed... in simple terms!

by Chris Wioskowski -
When I run the SHOW TABLE STATUS LIKE 'mdl_log'; query, it's telling me that my Data_Free size is 0.

I ended up backing up the mdl_log table to mdl_log_old and then I truncated the mdl_log table. I then re-ran the SHOW TABLE STATUS LIKE 'mdl_log'; query and it's still showing that the Data_Free size is 0.

I thought that this may mean that the table is corrupted so I ran all the checks and repairs via phpMyAdmin, and it said everything went ok, but I still get a Data_Free size of 0 when I run that query.

Is this going to be an issue for me? If so, does anyone know what I would do to correct this?
In reply to John White

Re: Insert into log failed... in simple terms!

by Gonzalo Rosetti -

Hi John and others!

Please see the status of the table attached after searching: SHOW TABLE STATUS LIKE 'mdl_log'; as suggested above.

I also checked and repair the table and everything was OK.

I have moodle installed in a disk with no capacity limit.

I am a teacher venturing into handling my moodle myself, so please be kind in your explanations wink

John suggests forcing the table to allow more than 4GB space. How can I do that? Maybe that's the solution.

What do you think?

Thanks,

Gonzalo

 

Attachment mdl_log.png
In reply to Mary Cooch

Re: Insert into log failed... in simple terms!

by Anthony Borrow -
Picture of Core developers Picture of Plugin developers Picture of Testers
Mary - Before checking the stuff that John suggests (which I think are good suggestions), I might first verify that it is not simply a corrupt table. When I have seen a failed insert on mdl_log it has often been because the mdl_log table became corrupted (this seems to be more common with mysql). Using phpmyadmin, I would first try to repair the mdl_log table. Peace - Anthony
In reply to Anthony Borrow

Re: Insert into log failed... in simple terms!

by heli g -
I'm having the same problem - receiving 'Insert into log failed..' notifications on running LDAP sync:
The failed SQL is:
INSERT INTO mdl_log (time, userid, course, ip, module, cmid, action, url, info)

I've verified mdl_log is not corrupt.

I ran
SHOW TABLE STATUS LIKE 'mdl_log';

And it indicates that there is no free space: Data_free: 0

I reduced the 'Keep logs for' setting - but it had no effect.

What should I do now?

Any assistance will be greatly appreciated

Heli
In reply to heli g

Re: Insert into log failed... in simple terms!

by Jon Witts -
Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Have you verified that there is any free space on the disk or your database quota size?

If either of these is full you really need to look at getting these limits raised.
In reply to Jon Witts

Re: Insert into log failed... in simple terms!

by heli g -
Hi Jon,

I haven't 'verified that there is any free space on the disk' of the database.

Could you please tell me how to do this (using either phpmyadmin or bash shell)?

Thanks in advance

Heli
In reply to Mary Cooch

Re: Insert into log failed... in simple terms!

by Rosario Carcò -
I had such an issue after mooving my production server to a VMware virtual machine. Despite importing the moodle database through a dump, the system began to timeout with database connection errors.

One of my investigations threads resulted in the mentioned insertion error in the moodle-log table. As I had 1.4 million rows I truncated (emptied) the table with phpMyAdmin, but after a few days mysqld began to hang again. So I turned off all cron-jobs of moodle, i.e. nightly backups (truncated also this table because it had also a lot of rows) and statistics (maybe I truncated also these few tables) and I truncated mdl_log again. I tryied also

myisamchk -a -S /var/lib/mysql/moodle/*.MYI

as proposed in a moodle-doc. You have to shut down mysqld to do this. It seems to rebuild the indexes and I have no clue what the difference is, compared to CHECK, REPAIR or OPTIMIZE TABLE you can use directly on the mysql prompt or in phpMyAdmin.

After that mysqld recovered normal operation and I enabled course backups again. Seeing that nightly backups and statistics cumulated a lot of CPU-time on mysqld, I switched off statistics again and reduced backups to Mo, We and Fr. It may be worth mentioning that our site has 2'500 courses and 8'000 users, increasing!

On the VM ESX with SUSE 11 I still did not get a stable operation and hence migrated back to the previous physical server. I am still investigating on my VM since, which seems to time-out or serve Moodle-Pages very quickly if not under load, but starts to eat 18 secs and more to return a page if under load (e.g. 100 concurrent wget in a loop).

I described my nightmare in another thread because more than one reason was involved (http://moodle.org/mod/forum/discuss.php?d=125702)

Rosario
In reply to Rosario Carcò

Re: Insert into log failed... in simple terms!

by Anthony Borrow -
Picture of Core developers Picture of Plugin developers Picture of Testers
Rosario - I received reports of very similar behavior on a production server that was using Hyper-V and Ubuntu 9.04 Server. It was very difficult to track down but seemed related to disk read/write errors. Fortunately, it seems that whatever was creating the problem has finally gone away (hopefully) as it has been a while since we have experienced troubles. It seemed to creep up randomly. It seemed as if it were taking a few days for the problem to surface so at one point the local site admin was going to just restart the server every night when there was no activity. Eventually there was an update for Hyper-V which seemed to correct things but it was very challenging to track down and we never found anything obvious. Best of luck and let me know if you have any questions. I would be interested if you find anything. Peace - Anthony