This is part of a series of small blog posts which will cover some of the smaller, perhaps less likely to be noticed, features of IBM MQ. Read other posts in this series.
Most of my Little Gem posts are about features of IBM MQ that have been around for a while and which may have been forgotten about. This month, I am writing about a fairly new feature of IBM MQ that you may not have noticed being there.
IBM MQ V9.0.5 CD release introduced the capability for IBM MQ to write its error messages to the UNIX Syslog. If you are using IBM MQ Long Term Service (LTS) releases, this feature becomes available to you in V9.1.0.

To use this feature, update the queue manager's qm.ini file as follows.
DiagnosticMessages:
Name=MsgsToSyslog
Service=Syslog
Now stop and restart the queue manager.
endmqm -w MQG1
strmqm MQG1
Now you will see that all of your queue manager error messages are written to the Syslog in a JSON format.
You may consider that you don't need to have all the MQ error messages written there, only the errors (or worse). To do this change the queue manager's qm.ini file as follows.
DiagnosticMessages:
Name=MsgsToSyslog
Service=Syslog
Severities=E+
ExcludeMessage=9999
SuppressMessage=9782
I have also illustrated here that you can also use both the ExcludeMessage and SuppressMessage attributes that were available in earlier IBM MQ releases, as well as the new Severities attribute, when writing to the System Log.
Now stop and restart the queue manager.
endmqm -w MQG1
strmqm MQG1
An easy way to generate an error message with a severity of ERROR or higher is to stop an unknown channel name.
Now look in your Unix System Log, for example:-
tail -n 50 /var/log/messages
You'll see the IBM MQ error message as follows.
Jan 27 19:16:16 GEMLNX1 ibm-mq: {"ibm_messageId":"AMQ9519E","ibm_arithInsert1":0,"ibm_arithInsert2":0,"ibm_commentInsert1":"RUBBISH.CHANNEL.NAME","ibm_datetime":"2019-01-27T06:16:16.274Z","ibm_serverName":"MQG1","type":"mq_log","host":"GEMLNX1","loglevel":"ERROR","module":"amqrcmsa.c:2390","ibm_sequence":"1548569776_275474956","ibm_qmgrId":"MQG1_2019-01-27_17.47.25","ibm_processId":"3879","ibm_threadId":"1","ibm_version":"9.0.5.0","ibm_processName":"amqrcmla.exe","ibm_userName":"mqgemusr","ibm_installationName":"Installation1","ibm_installationDir":"/opt/mqm905","message":"AMQ9519E: Channel 'RUBBISH.CHANNEL.NAME' not found."}
This idea of funneling only a certain set of messages to another logging target is also available to use with additional error log files of your own name and location. In the case of an additional error log file, there is a Format attribute which can be set to either text or json. Unfortunately, you cannot use the Format attribute in combination with Service=Syslog which is a shame because I think the JSON style looks rather out of place in the Syslog.
I have raised an RFE to request that Format=text be allowed with Service=Syslog. If you agree, please vote for it here.
#Little-Gem#IBMMQ#ChampionsCorner