Any advice on extracting records from logs/messages.json

Hi all,

I’ve become interested in polling (and acting on) the data at Discourse’s /logs endpoint (from Python, not that it is relevant to the question).

TL;DR: Has anyone managed to extract filtered information from /logs/messages.json?

Full version:

I’ve established the data displayed on /logs/ comes from messages.json

Other than that I’ve also determined a couple of URLs which should do /something/ but I’ve had very little success extracting the data I want

Filtering log levels


Filtering log levels is one thing that does actually do what I expect - i can remove items and the number of results changes.

filter = an underscore separated list of error levels to display (Debug to Fatal)



I was expecting this to return only records after that entry (which is a nonce from an SSO record) but from a look at the code it doesn’t appear the ‘after’ bit is actually wired in?

If it is wired in I assume I’m using the wrong value to filter ‘after’ on.

individual records

Based on these links I assumed I would be able to show individual records

I’ve been equally unable to show based on nonce, seeing the message “Message not found” when I visit the url.

regex search

I figured out I need regex_search set true

What I can’t figure out is how to use the regex - as with /show/ I’m seeing the “Message not found” or (unlike /show/) everything returned.

I can see the regex required (and that it has insensitive searching support), I haven’t figured out how to encode it for transmission - posted? url encode? Post seems wrong from looking at the code.

So, anyone have any suggestions on where I can investigate further?