You can now configure IBM MQ Queue Manager Logs with Log DNA Service offered in IBM Cloud. A well designed, reliable logging system is a huge utility for developers, system administrators, SRE’s, Devops Engineers, Security team etc. The messages that are recorded in the error logs and queue managers logs are the most important information that you can provide when reporting an MQ problem or while debugging an issue.
Why Logging ?
Logging can further be used to configure an Alerting and Monitoring mechanism for the application, system resources etc to alert the engineers in case of some unexpected event is logged in the log files.
With IBM Cloud continuously evolving they now offer an enhanced logging experience with IBM Log Analysis with Log DNA, which offers collection and search services with a tightly integrated LogDNA service.
What is Log DNA ?
LogDNA can act as a centralized log management service with blazing fast search, intuitive query language, and smart alerting that gives developers and operations engineers the ability to find issues fast.
[Optional] for detailed information on Log DNA announcement with LogDNA please visit link here
- A Service instance of Log DNA running in IBM Cloud. Click here to create one Log DNA instance.
Note : Incase the above link does not work then goto https://cloud.ibm.com/ -> Log in with your account -> go to to Catalog -> Search “Log DNA” -> Create a LogDNA Service instance.
- Installed and ready to use IBM MQ Advanced in your machine.
In the following guide i will guide you to configure the IBM MQ Logs with Log DNA
- Before starting your queue manager i.e. before executing the MQ strmqm command you need to set an Environment Variable. 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.
e.g. for windows SET AMQ_ADDITIONAL_JSON_LOG=1
for linux export AMQ_ADDITIONAL_JSON_LOG=1
- Now execute the strmqm QUEUE_MANAGER_NAME
- All your queue manager logs in json format will now be available be in location
(i) for windows system : MQ_INSTALLATION_PATH\QMGRS\qmname\ERRORS\AMQERR01.json
(ii)for linux system : /var/mqm/qmgrs/qmname/errors
- The above steps has been illustrated in the screenshot below:
- Now we will start configuring the IBM Log Analysis with Log DNA in IBM Cloud. We expect by now that you would have a running Log DNA service instance in IBM Cloud.
- Click on “Edit log sources”, this would give details on configuring log DNA with your ubuntu/debian or rpm machines or you can follow the instructions as illustrated below :
- Now, you can navigate to directory /var/mqm/qmgrs/QM1/errors using command
cd /var/mqm/qmgrs/QM1/errorsand confirm that the logs files will now be present with a *.json extension
- we will use following commands for configuring the logDNA agents with the linux system.
In my case its a docker container where i have my IBM MQ installed. You can run the following commands one by one against your debian/ubuntu box for configuring the logs with Log DNA.
- Step 1.
echo "deb https://repo.logdna.com stable main" | sudo tee /etc/apt/sources.list.d/logdna.list
- Step 2.
wget -O- https://repo.logdna.com/logdna.gpg | sudo apt-key add -
- Step 3.
sudo apt-get update
- Above 3 steps has been shown in the screen shot below
- Step 4.
sudo apt-get install logdna-agent < "/dev/null" # this line needed for copy/paste
- Step 5.
sudo logdna-agent -k
# this is your unique Ingestion Key available in your LogDNA Service Instance
- Step 6.
sudo logdna-agent -s LOGDNA_APIHOST=api.us-south.logging.cloud.ibm.com # this is your API server host
- Step 7.
sudo logdna-agent -s LOGDNA_LOGHOST=logs.us-south.logging.cloud.ibm.com # this is your Log server host
- Step 8.
sudo logdna-agent -d /var/mqm/qmgrs/QM1/errors
- Step 9.
# You can configure the agent to tag your hosts with the hostname like servername1:
- Step 9.
sudo logdna-agent -t myUbuntu1
- Step 10.
sudo update-rc.d logdna-agent defaults
- Step 11.
sudo /etc/init.d/logdna-agent start
- Following is the screenshot that comprises of the above steps.
Similarly, you can configure the IBM MQ running in different hosts against the same Log DNA service instance and use it as alerting, monitoring and a unified logging service for all your queue manager logs needs.
You can use the various other features provided by Log DNA for more enhancement and improvement on the Log DNA service. Please feel free to drop any suggestions/comments for further improvements.