Which API query to use to count logs

Hello, everyone,
I haven't been using Graylog for longPreformatted text. Now I have it set up and can monitor four servers. I would now like to use the API to query whether a server has written log files in the last few hours. Not more.
I'm currently trying the "views/search" query. I have already shortened the code to the bare essentials. Now I have a few questions. Can I even use the query for this? How do I enter query_string? for example: "agent_name:abcd\efgh\-u05".

Which IDs do I have to enter at the positions?

I would be very happy about helpful answers.

This is my code:
  "queries" : [
      "query" : 
        "type" : "elasticsearch",
        "query_string" : "*"
      "id" : "4d640ed0f61211ecb1a7005056870c0e",
      "timerange" : 
        "type": "relative",
        "range": 600
  "id" : "5ff438549150ddc6b4ce5319"

Hello && welcome @UserIT529

Not sure exactly what you doing or version you have but try using Graylogs API Dashboard. It located
under System/Nodes

From there you can get you ID’s, etc…

Thank you, for your answer!
But on your screenshot I can´t see any ID´s… I mean the ID´s in the Code. Where can I find them?


You may want to look at this document.