Configuring WebSphere MQ Error log sizes

No, not *that* kind of tuning!

I’ve been keeping a running blog post of questions and answers from the WebSphere MQ Admin seminar this week in Amsterdam, but the more I researched this topic, the longer the answer became.  Eventually, it spilled over into its own post.

It turns out that the behavior and controls have changed from version to version and even across Fix Packs.  That means after applying a fix Pack or upgrading to a new version, things might break.  For a new QMgr it won’t “break” anything but it might not behave as expected if you set the parameters based on the old version.  Here then is the story of the many facets of error log size tuning.

Q: I need to increase the size of my MQ error logs.  Where are the error log file sizes specified?

A: The log file sizes can be tuned using the MAXMQERRORLOGSIZE environment variable, the qm.ini file and/or the QMgr attributes in the WebSphere MQ Explorer Extended Attributes panel.  If the environment variable is changed, the queue manager and local applications must be restarted to pick up the change.  If the ini file is changed, the queue manager (but not the local applications) must be restarted to pick up the change, after which the value will be visible in the WebSphere MQ Explorer Extended Attributes panel.  If the size is adjusted using by altering the queue manager attribute in WMQ Explorer, it takes effect immediately and the value is saved to the ini file by the queue manger. Note that there is no equivalent MQSC command for this attribute.  It is available as PCF and WMQ Explorer exposes it in the Extended Attributes panel.  Other PCF-based tools may or may not expose this attribute.

The features regarding error log size differ slightly by version so here are links and descriptions for each.

As of v5.3, the MQMAXERRORLOGSIZE environment variable allowed for increase of the size of the global error logs and the queue manager’s error logs.  The problem with this was that any process for which the environment variable was not set would truncate the error logs to 256k.  Additionally, on iSeries you needed to delete the existing files in order to make the change as described here.

As of V6.0, an attribute was placed in the qm.ini file that eliminated the problem of having to put the environment variable everywhere.  But the ini file setting only affected the queue manager’s logs and was not available on iSeries. If you wanted to change the global error log sizes, you still needed the environment variable.

As of Fix Pack 6.0.2.4, the the MQMAXERRORLOGSIZE  variable was still available on all distributed platforms, including iSeries, but in the first release and the early fix packs of V6.0 MQMAXERRORLOGSIZE affected only the global error logs.  If the enviroment variable was used but the qm.ini file did not contain an entry, the queue manager’s log file size remained at 256k.  This behavior was changed in Fix Pack 6.0.2.4 so that in the absence of an ini file setting, the environment variable applied to the global and the queue manager error log files.  If both the MQMAXERRORLOGSIZE  environment variable and the qm.ini’s ErrorLogSize and are set, the qm.ini setting takes precedence for that queue manager’s error logs.    The Infocenter page is here.  A Technote that further explains all this is here.

As of V7.0, the MQMAXERRORLOGSIZE variable is completely absent from the Infocenter, however it is mentioned in a Technote as being applicable to that version.  The qm.ini file setting is documented however, and the Infocenter page describing how to change the qm.ini file or use WMQ Explorer to update the setting is here.

As of V7.1, both the environment variable and the qm.ini file setting are documented.  More importantly, the default size of the logs was changed from 256k to 2MB which could eliminate the need for tuning if you had been using a value equal to or smaller than that size.  The Infocenter doesn’t specify that this applies to only QMgr logs or only global logs so it applies to both.  I haven’t confirmed this yet so if you notice it isn’t acting this way, please let me know.  There is a small possibility that the new defaults apply only to QMgr error logs and the Infocenter is wrong.

In the event you have iSeries and would still like to tune the error log sizes above 4MB, the Infocenter page does not mention WebSphere MQ Explorer, nor does it mention any requirement to delete the existing files before changing the setting.  However, the Technote mentioned previously is marked as applicable to V7.1 so plan on deleting the error log files if you change this value on V7.1.

On other distributed platforms, the option to use WMQ Explorer is offered and you can choose that or to update the qm.ini file.  The Infocenter page for that option is here.

Interestingly, the MQMAXERRORLOGSIZE environment variable is mentioned in the Infocenter for V7.1 as applying only to the queue manager files.  The global error log files are not addressed.  Googling for “mq errorlogsize 7.1 technote” doesn’t turn up any hits.  If the Infocenter had not explicitly specified “queue manager error logs” I would have assumed the variable retained the old behavior of applying to the global error logs as well.  If you have a V7.1 setup, I’d be curious what behavior you are seeing with regard to this variable and the global error logs.

As of V7.5, the Infocenter has the same content as for V7.1.  However, since this is the version I have on my laptop and can test easily, I tried setting MQMAXERRORLOGSIZE as a global system variable, rebooted and generated massive quantities of global and QMgr-specific errors.  In all cases, the logs rotated at 2MB.  In instances like this I always assume I’ve got a typo or other PEBCAK error so I’ll try again tomorrow and keep this post updated as I go.

My conclusion from all this is that if error log size is important to you (for example, your QMgr tends to roll them over before you can diagnose an error) then it is worth verifying that your setting is appropriate, especially if you have changed versions or are running a large network with many different versions.  Alternatively, you may wish to capture the AMQERR03.LOG files whenever the timestamp changes.  In windows you may wish to look at Microsoft’s Process Monitor utility and in Linux the iNotify facility looks like it would do the trick.  I’ll look at these at some point when I get a free afternoon and post results, but if you try them before then please let me know how it goes.

This entry was posted in Events, IBMMQ and tagged , , , , , , , , , , . Bookmark the permalink.

7 Responses to Configuring WebSphere MQ Error log sizes

  1. hopsala says:

    Hey T.Rob, thanks for this post –
    It looks like the more standard way to do this in MQ 7.5 onwards is with the QMErrorLog stanza. See http://www-01.ibm.com/support/knowledgecenter/SSFKSJ_7.5.0/com.ibm.mq.con.doc/q019020_.htm
    Although supposedly MQMAXERRORLOGSIZE is still supported: http://www-01.ibm.com/support/knowledgecenter/SSFKSJ_8.0.0/com.ibm.mq.mig.doc/q001390_.htm
    Cheers

  2. Tibor says:

    If anyone is interested in rotating log files, here is a shell script:

    mqlogrotate.zip

    #!/bin/sh
    #
    # mqlogrotate.sh path1 path2 ...
    
    ARGS="$@"
    SDATE=`date +"%Y%m%d"`
    
    for LOGPATH in $ARGS; do
      if [ -d $LOGPATH ]; then
        # an existing directory
        LOGLAST=$LOGPATH/AMQERR03.LOG
        LOGPLUS=$LOGPATH/AMQERR00.LOG
        LOGBACK=$LOGPATH/AMQERR00.$SDATE.LOG
        # 1st line contains a timestamp
        LOGDIFF=`cmp $LOGPLUS $LOGLAST | grep -c "line 1"`
        if [ $LOGDIFF -ne 0 ]; then
          # if last log differs to last backup
          # then copy to the daily backup file
          cat $LOGLAST > $LOGPLUS
          cat $LOGLAST >> $LOGBACK
          echo $0 `date +"%Y.%m.%d %H:%M"` rotating to $LOGBACK
        fi
      fi
    done
    

    Scheduling example:

    * * * * * /home/mqm/mqlogrotate.sh \
         /var/mqm/errors \
         /var/mqm/qmgrs/QM1/errors \
         /var/mqm/qmgrs/QM2/errors \
         >> /home/mqm/cron.out 2&>1
    
    • T.Rob says:

      Tibor, that is great! Thanks! I tried to make WordPress format it a bit better but it kinda sucks. Would it be OK with you if I made it a downloadable file and linked the file from your comment? That way people would not have to edit out line-ends and HTML tags that I cannot seem to get rid of. Also, can I include it (with attribution) in my upcoming IMPACT session?

      Thanks! — T.Rob

      • Tibor says:

        Of course, yes – both of your questions 🙂

        • T.Rob says:

          Thanks! Done. Amazingly, I was able to figure out the formatting but not until after I’d already saved to a file and uploaded so I left it there as both a link and as text so people can view it. This is a utility I’ve been wanting to tackle for a long time so I’m really happy that you provided it. Between this and tuning the log file sizes much larger we should be able to reliably capture all our debug info now.

  3. Ajay kumar says:

    can i increse the log file pages?

    • T.Rob says:

      Log file pages are transaction logs whereas this post was about error logs. None of the tuning described here applies to transaction logs. But to answer your question, changing the log file pages requires deleting and recreating the queue manager. You can however change the number of log file extents and just bounce the queue manager. Check the Infocenter page for transaction logs.

Leave a Reply to T.RobCancel reply