Up until now, MQ Error logs have only been in human readable format. This makes it challenging for other applications to digest the information in these logs.
We’ve been looking at how to make that easier, so as of MQs continuous delivery release 9.0.4 it is now possible to have the same information in JSON format. This is more a technology preview than a fully fledged feature so some of the specifics may change in the future. However if you’re happy to experiment please read on…
How to enable JSON format error log.
This is an opt-in feature, and by setting an environment variable AMQ_ADDITIONAL_JSON_LOG with the value 1 prior to running MQ commands, for example starting MQ with strmqm, it will generate JSON formatted error logs as well as the original format.
Where are these JSON formatted error logs.
They are located in the same directories as the AMQLOG01/2/3.LOG files and have names AMQLOG01/2/3.json. As with the original error logs there are separate JSON error log files for each queue manage and also for system errors.
What is contained in a JSON formatted error log
Here is a sample JSON entry (it’s been reformatted for readability)
"message": "AMQ5051I: The queue manager task 'LOGGER-IO' has started."
and here is the textual equivalent
16/11/17 09:54:26 - Process(7846.4) User(somebody) Program(amqzmuc0)
AMQ5051I: The queue manager task 'LOGGER-IO' has started.
The critical utility task manager has started the LOGGER-IO task. This task has
now started 1 times.
In general, the JSON form has more information than it’s textual version with a notable exception. There is no Explanation or Action entries, but these are be generated using the mqrc command, for example
mqrc AMQ5051 –n 1 –n 1 –c LOGGER-IO
All of the JSON entries
Below is a table of possible entries that could occur in a JSON error log. Most JSON error logs will only contain subset. In the sample above there are two inserts, but potential there could be up to five inserts
|ibm_messageId||No||message identifier for example AMQ5051I|
|ibm_arithInsert1||Yes||first numerical insert value|
|ibm_arithInsert2||Yes||second numerical insert value|
|ibm_commentInsert1||Yes||first string insert value|
|ibm_commentInsert2||Yes||second string insert value|
|ibm_commentInsert3||Yes||third string insert value|
|ibm_datetime||No||ISO8601 format of the date and time when the message was generated|
|ibm_serverName||Yes||name of the queue manager|
|type||No||type of error log currently only “mq_log”|
|host||No||name of the host machine|
|loglevel||No||severity of the error log, i.e. ERROR|
|module||No||internal details of where the message was generated|
|ibm_sequence||No||unique reference number|
|ibm_remotehost||Yes||IP address of remote machine|
|ibm_processId||No||o/s reference for the process generating the message|
|ibm_threadId||No||o/s reference for the thread generating the message.|
|ibm_processName||No||name of the process generating the message|
|ibm_userName||No||real user id of the process generating the message|
|ibm_installationName||No||name of the associated installation|
|ibm_installationDir||No||location of the installed files|