Search code examples
python-2.7graylog2

How get message ID (hash) in GrayLog2 API response?


I use the Graylog2 API to get messages from the Graylog2 server. It will be very helpful for me if I could get gl2 message ID. The GrayLog don`t have any mechanism similiar to auto increment in SQL but ID value of hash is always same and unique for message.

Unfortunately that value in not exists in response data with messages by default.

My connector was written in Python and uses requests lib for HTTP connection.

How can I get the message ID using the Graylog2 API?

http://<GL2_Server_IP>:12900/search/universal/absolute?query=_exists_%3AFoobar+AND+_exists_%3AFoobar2&from=2016-04-29%2003%3A43%3A49.461&to=2016-05-31%2015%3A43%3A49.461&filter=streams%<Stream_ID>&fields=Foobar%2C%20Foobar2

Solution

  • I got the answer in google group for GrayLog 2. Maybe that will be helpful for someone.

    https://groups.google.com/forum/?hl=en#!topic/graylog2/Ab5RkDmAUyc