How to search messages using REST API

one open would be to use the relative time,

Include the streams ID you want to search in, include the query string in the query_string object and the time you want to search as relative.

The below search will return as CSV/export.

## Search via Export API
curl -X "POST" "https://graylog.ch/api/views/search/messages" \
     -H 'X-Requested-By: Mamamia' \
     -H 'Content-Type: application/json' \
     -H 'Accept: text/csv' \
     -u 'admin:password' \
     -d $'{
  "streams": [
    "5e569003c793163fea1b3373"
  ],
  "query_string": {
    "type": "elasticsearch",
    "query_string": "section:boulder"
  },
  "timerange": {
    "type": "relative",
    "range": 30000
  }
}'

3 Likes