All Products
Search
Document Center

Message Service:Log query tool

Last Updated:Sep 27, 2023

This topic describes the log query tool that allows you to query operations logs of messages. When you use the tool, you must specify a queue or topic name, a message ID, and the start time and end time of a period to be queried.

Release notes

  • Version: 1.0.0

  • Released date: March 15, 2016

  • New feature

    Operations logs can be queried by queue name, topic name, message ID, and time range.

Installation

  1. Download the log query tool.

  2. Go to the mns_logging directory and run one of the following commands to install the tool based on the operating system of your client:

    • For Linux

      sudo python setup.py install

    • For Windows

      python.exe setup.py install

    Note

    The preceding commands are based on Python 2.x.

For more information about the installation, see the aliyun-mns-logging-cmd-1.0.0/mns_logging/README file.

Parameters

Configure the endpoints of MNS and Object Storage Service (OSS), Alibaba Cloud account, and AccessKey pair. In this example, Alibaba Cloud resources that are deployed in the China (Hangzhou) region are used.

mnslogging_cmd config --ossendpoint=http://oss-cn-hangzhou.aliyuncs.com --endpoint=http://$accountid.mns.cn-hangzhou.aliyuncs.com --accesskeyid=$your_accesskey --accesskeysecret=$your_accesskeysecret 
  • $accountid: the ID of the Alibaba Cloud account. You can log on to the Alibaba Cloud Management Console to view the account ID.

  • $your_accesskey: the AccessKey ID of the Alibaba Cloud account. You can log on to the Alibaba Cloud Management Console to view the AccessKey ID.

  • $your_accesskeysecret: the AccessKey secret of the Alibaba Cloud account. You can log on to the Alibaba Cloud Management Console to view the AccessKey secret.

Query queue logs

To query the log entries of a message in a queue, you can specify the queue name, message ID, and time range.

mnslogging_cmd queryqueuelog --queuename=$queuename --msgid=$msgid --starttime=$starttime --endtime=$endtime
  • $queuename: the name of the queue.

  • $msgid: the ID of the message.

  • $starttime: the start time of a period to be queried.

  • $endtime: the end time of a period to be queried.

Example:

Query queue logs

Query topic logs

To query the log entries of a message in a queue, you can specify the queue name, message ID, and time range.

mnslogging_cmd querytopiclog --topicname=$topicname --msgid=$msgid --starttime=$starttime --endtime=$endtime     
  • $topicname: the name of the topic.

  • $msgid: the ID of the message.

  • $starttime: the start time of a period to be queried.

  • $endtime: the end time of a period to be queried.

Example:

Query topic logs