Purging the log

merlinsilk wrote on Monday, September 21, 2015:

Is there a way - a safe one - to purge the log, maybe after archiving it?
This log is growing like wildfire, using three quarter of the whole DB.
Thanks, Merlin

bradymiller wrote on Monday, September 21, 2015:

Hi Merlin,

Do you mean the php log or the stuff in the OpenEMR log database table?

-brady
OpenEMR

merlinsilk wrote on Tuesday, September 22, 2015:

The OpenEMR log DB table.
M

bradymiller wrote on Tuesday, September 22, 2015:

Hi All,

I think this can be done in Administration->Backup->‘Create Eventlog Backup’, which I think deletes the log after it backs up to a file. It just hit me that there may be a nasty bug here, though, so recommend doing a backup before doing this.

The likely bug is related to the log authentication feature that was added in below commit which maps items in the new log_comment_encrypt sql table to the log sql table. Thus if you dump the log table, I bet the log table mapping in log_comment_encrypt table will be broken (and thus the authentication log feature will break). MU2 rebase to allow review with brady's suggestions incorporated. · openemr/openemr@0590326 · GitHub

Thus, when dump the log table, also need to dump the log_comment_encrypt table.

Anybody up for testing and fixing this, if needed?

-brady
OpenEMR

tmccormi wrote on Wednesday, September 23, 2015:

The OEMR will pay a bounty of $150.00 for this bug fix, too serious to leave on the table…

Tony
OEMR Prez

bradymiller wrote on Wednesday, September 23, 2015:

hint:

visolveemr wrote on Saturday, September 26, 2015:

Hello Brady

This fix has been done in the backup.php file, where the ‘log_comment_encrypt’ table also been backed up and purged along with ‘log’ table. Commit link is here.
Do share your views.

Thanks
OpenEMR Customization/Support Team,
ViSolve Inc
services@visolve.com | Phone: 408-850-2243
Demo’s @ ViSolve Demo Library

bradymiller wrote on Saturday, September 26, 2015:

Hi Visolve,

We have a winner! Your solution looks good and tested well. I committed this to the codebase.

-brady
OpenEMR

robertovasquez wrote on Saturday, September 26, 2015:

Hey Visolve
You won by a nose. :slight_smile:

tmccormi wrote on Monday, September 28, 2015:

Send an invoice to
OEMR 501c3
P.O. Box 230609
Tigard Oregon 977223

or via email president@oemr.org

And Thanks!

Tony McCormick, CTO

Support: 866-735-0897, Direct: 713-574-6709
My Calendar: http://bit.ly/XznvDo
“It makes me feel young again to be wrong so often now.” - paraphrased from
Greg Bear

On Sat, Sep 26, 2015 at 7:24 AM, Roberto robertovasquez@users.sf.net
wrote:

Hey Visolve
You won by a nose. :slight_smile:

purging the log
https://sourceforge.net/p/openemr/discussion/202504/thread/660026a6/?limit=25#875f

Sent from sourceforge.net because you indicated interest in
OpenEMR / Discussion / OpenEMR Users

To unsubscribe from further messages, please visit
SourceForge.net: Log In to SourceForge.net


Please be aware that e-mail communication can be intercepted in
transmission or misdirected. Please consider communicating any sensitive
information by telephone. The information contained in this message may be
privileged and confidential. If you are NOT the intended recipient, please
notify the sender immediately with a copy to hipaa-security@mrsb-ltd.com and
destroy this message.

merlinsilk wrote on Thursday, October 01, 2015:

As I am using this backup feature and don’t want to break anything, I applied the changes to backup.php to my installation - thank you for the fast fix! Now I wonder when this fix will make it into a patch, and then later into a release. Up to that time I will have to treat it as a private customization with all the drawbacks.
When using this backcup I observed new log entries coming in and noticed that one of the entries in the log_comment_encrypt had a checksum, which would indicate some encryption (?) and looking in the corresponding log entry I found
UPDATE background_services SET active=?, next_run = next_run + INTERVAL (? - execute_interval) MINUTE, execute_interval=? WHERE name=? (‘0’,‘5’,‘5’,‘phimail’)
First of all I wonder why this would be the only entry with a checksum in log_comment_encrypt and second - what is that anyway?? background service, for one, and mail - I can’t send any mail and don’t really want to. Is this something I can disable and what other background services might there be?
Thanks, Merlin

merlinsilk wrote on Thursday, October 01, 2015:

One thing I noticed when manually applying the patch to backup.php:
In the same directory there is a shell script that does the same - this probably should be updatd with Visolve’s correction, and there is another php file backuplog (I believe) which has some part of the backup functionality - but might be just a corpse or leftover. If it is still used somewhere this one should be updated as well.
Merlin

bradymiller wrote on Friday, October 02, 2015:

Nice catch on this Merlin!

Visolve,

can you also fix the following script(note that we will need to rely on your testing of the fix):

-brady
OpenEMR

bradymiller wrote on Friday, October 02, 2015:

Hi Merlin,

The background services is a super cool feature that was developed to support Direct by EMRDirect (but built in a generic fashion to support any other service). It was developed because for Direct, OpenEMR needs to connect to the Direct server to collect messages:
http://www.open-emr.org/wiki/index.php/Background_Service_Manager

The master script is:

The script is basically called whenever a user is logged in I think every 30 seconds (it piggybacks off the call that updates the number of Messages in the left_nav), which is the poor man method; or can also run it from cron if don’t want to rely on a user logging in.

The background services are stored in the background_services sql table and note that one could basically add any function they want to be run as a service. The only thing in there on an install is the phimail service which is for Direct.

You can view the list of services in OpenEMR at:
Reports->Services->Background_Services

Note that the phimail service is not on by default. The statement you are seeing is what happens when you save Globals (the phimail service settings can be set in globals) and note that in your statement that the active flag is set to 0(ie. off).

hope this helps,
-brady
OpenEMR

bradymiller wrote on Friday, October 02, 2015:

For the other questions:

  1. Plan a “quick” release when OpenEMR gets MU2 certified. If this takes too long, then do plan a patch, which will contain this fix.
  2. Regarding the checksum in log_comment_encrypt, it appears from glancing at that code that it is only done for UPDATE commands:
    openemr/library/log.inc at master · openemr/openemr · GitHub

visolveemr wrote on Friday, October 02, 2015:

Sure Brady, Will fix and commit this.

Thanks
OpenEMR Customization/Support Team,
ViSolve Inc
services@visolve.com | Phone: 408-850-2243
Demo’s @ ViSolve Demo Library

merlinsilk wrote on Sunday, October 04, 2015:

Thank you so much Brady!

visolveemr wrote on Tuesday, October 06, 2015:

Hello Brady

As mentioned the log shell script file has been updated and tested. Here goes the commit link.

Thanks
OpenEMR Customization/Support Team,
ViSolve Inc
services@visolve.com | Phone: 408-850-2243
Demo’s @ ViSolve Demo Library

bradymiller wrote on Wednesday, October 07, 2015:

Hi Visolve,
I posted a question on github.
-brady
OpenEMR

visolveemr wrote on Wednesday, October 07, 2015:

Brady
Answered in github and implemented the change.

Thanks
ViSolve Inc