I need to execute search from API but haven’t had any luck, can anyone help with a basic example using the following endpoint?
/views/search/sync
Just need to search for presence string in the message field and within timerange.
I need to execute search from API but haven’t had any luck, can anyone help with a basic example using the following endpoint?
/views/search/sync
Just need to search for presence string in the message field and within timerange.
Hi @dansl!
Maybe the API-Browser, which is reachable via the System -> Node Nav-Entry, can help you figuring out the problem.
There are the necessary request & response JSON-Payload fields (key & value-datatype) listed.
Greets
I have reviewed that but being new to graylog I’m not sure what the syntax of the values need to be.
For example, here is the model provided, but what is the value format for ‘querys’ to look for data in a message?
{
id (string, optional),
queries (array[object], optional),
parameters (array[object], optional),
owner (string, optional),
created_at (string, optional),
requires (object, optional)
}
Try to use this curl command:
curl -u admin:password -H 'X-Requested-By: cli' "http://GRAYLOG_IP_OR_HOSTNAME/api/search/universal/relative?query=*&range=3600&limit=100&sort=timestamp:desc&pretty=true" -H "Accept: application/json" -H "Content-Type: application/json"
Where:
query=*
- replace * with your desired string
range=3600
- replace 3600 with time range (in seconds)
limit=100
- replace 100 with number of returned results
sort=timestamp:desc
- replace timestamp:desc with field you want to sort
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.