web stats
Prune Error Messages from Mirth - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 09-06-2019, 11:24 AM
surbhit4u surbhit4u is offline
Mirth Newb
 
Join Date: May 2011
Posts: 15
surbhit4u is on a distinguished road
Question Prune Error Messages from Mirth

Hi,

I am using Mirth 3.2.2.7694

I would like to get rid of older ERROR messages (Atleast the ones that are more than 180 days old). How can I prune those ERROR messages.
Currently they just keep lying for ever. And we have no intention of keeping them.. I am hereby talking about production instance where there are more than 1000 such Mirth installs.. And manually deleting data from everyone of them is not possible.

We have Data pruner turned on, and that deletes successful (SENT status) messages after every 30 days.
Reply With Quote
  #2  
Old 09-06-2019, 11:35 AM
cory_cole cory_cole is offline
Mirth Guru
 
Join Date: Mar 2012
Posts: 1,245
cory_cole is on a distinguished road
Default

On the summary page, below the prune data is a checkbox ('Allow message archiving'). Uncheck that box.
Reply With Quote
  #3  
Old 09-09-2019, 07:35 AM
agermano agermano is offline
Mirth Guru
 
Join Date: Apr 2017
Location: Indiana, USA
Posts: 896
agermano is on a distinguished road
Default

I recommend voting for this issue. There is a workaround presented there.

If you don't want to update the database directly, you can have a channel that makes REST API calls to delete the old ERROR messages the same way you would do it manually from the client.

http://www.mirthcorp.com/community/i...wse/MIRTH-3116
Reply With Quote
  #4  
Old Yesterday, 07:15 AM
surbhit4u surbhit4u is offline
Mirth Newb
 
Join Date: May 2011
Posts: 15
surbhit4u is on a distinguished road
Default

Quote:
Originally Posted by cory_cole View Post
On the summary page, below the prune data is a checkbox ('Allow message archiving'). Uncheck that box.
This does not delete the ERROR Messages
Reply With Quote
  #5  
Old Yesterday, 07:19 AM
surbhit4u surbhit4u is offline
Mirth Newb
 
Join Date: May 2011
Posts: 15
surbhit4u is on a distinguished road
Default

Quote:
Originally Posted by agermano View Post
I recommend voting for this issue. There is a workaround presented there.

If you don't want to update the database directly, you can have a channel that makes REST API calls to delete the old ERROR messages the same way you would do it manually from the client.

http://www.mirthcorp.com/community/i...wse/MIRTH-3116
Thanks. Is there any Mirth API available, which can perform the same things..So that we can just call the API to get rid of all the ERROR messages that are too old.
By the way, I voted for the issue
Reply With Quote
  #6  
Old Today, 08:56 AM
agermano agermano is offline
Mirth Guru
 
Join Date: Apr 2017
Location: Indiana, USA
Posts: 896
agermano is on a distinguished road
Default

Sorry, I suggested using the REST API, but I don't think that was available until mirth 3.4, and I just noticed you said you were on 3.2.

You can do it from a dedicated mirth channel using internal classes, but those are not part of a supported API (so subject to change without notice, though it looks like the 3.2 solution will probably still work in 3.8.)

I don't have time right now to show how to do it in detail, but the method you want to end up calling is removeMessages on the MessageController. See source code here.

You will need to construct a MessageFilter object to pass to the method along with the channelId. You can probably(?) get by just setting the endDate on the filter and leaving everything else untouched.

You should be able to find examples in the forums on how to get an instance of the controllers from mirth.

You can use ChannelUtil.getChannelIds() from the User API to get a list of all channelIds that you can iterate over since this will have to be called per channel.

For a kind-of-more-supported solution or if you wanted to run it from a different server than the mirth box itself, you could probably use the client-core java library, but that would also require digging into the source code to see how to actually make the client call (that will end up calling the MessageController I mentioned above.)

The Slack channel is another good place to ask for help if you get stuck on any of the things I mentioned above (though it would be nice to post back here once you have a working solution for the benefit of others.)
Reply With Quote
Reply

Tags
pruner

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 02:57 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Mirth Corporation