Hi,
I’m trying to produce searches using API calls through a JS App.
My function works partially as it encounters an ‘Unable to perform search query’ error for some searches:
{type: 'ApiError', message: 'Unable to perform search query'}
For the moment I suppose it is linked with the limit
parameter as it seems the failing requests are the ones that should be resulting in more than 1000 lines. The same requests works perfectly when tested directly from the graylog interface.
However increasing the limit value does not resolve the problem. I’m working with Graylog 4.0.15+a7bed0d (Used the ova available).
The elasticsearch / graylog-server services do not print any log.
EDIT 1
I tested 5 searches with the js function:
- 1st that should return 1024 line → PASSED
- 2nd that should return 7427 lines → FAILED
- 3rd that should return 2963 lines → FAILED
- 4th that should return 1260 lines → PASSED
- 5th that should return 2605 lines → PASSED
All requests were tested with a limit=10000, range=0
I tested the same searches using the API testing interface
([Legacy/Search/Relative] : Message search) → [GET] /search/universal/absolute
With limit value undefined and range equals 0 and the search WORKED
perfectly for any value
EDIT 2
I compared my request generated by the JS function and the request generated by the API testing interface. When using exactly the same parameters:
The request from my js function returns a response with 150 lines content ( the fedault limit I guess ?)
However manually increasing the limit parameter seems to fail when it the result content is higher than Approximatively 2605 - 2963 (On my instance)
Here is my js function:
function search(query){
let sessionId= "72175d8b-fc70-43fd-8146-8beded5d212a"
let body = $.param({
"query": query,
"range":0,
"decorate":true
});
let xhttp = new XMLHttpRequest();
xhttp.open("GET", "http://192.168.X.X:9000/api/search/universal/relative?"+body+"&limit=1000", false);
xhttp.setRequestHeader("Authorization", "Basic "+btoa(sessionId+":session"));
xhttp.setRequestHeader("X-Requested-By", "XXX");
xhttp.setRequestHeader("Accept", "application/json");
xhttp.send();
return JSON.parse(xhttp.responseText)
}