I had a bit of a dig into this and I have somewhat of a solution.
First, I clicked the
i icon on the "ALL EVENTS" panel to get my query.
Next, when the query is executed at the command line, I found that the number of results returned was always 10. Regardless of the value that was specificed here:
"size": 250,
So I removed
"size": 250, from the query and at the beginning of the query before the -d I added
&size=20 and I get 20 results.
Code: Select all
curl -XGET 'http://lsproduction01/nagioslogserver/index.php/api/backend/logstash-2015.09.11,logstash-2015.09.10/_search?pretty&token=c8d0c7a3a064a065339f5f9e21dd7a63e540890d&size=20' -d '{ "query": { "filtered": { "query": { "bool": { "should": [ { "query_string": { "query": "message:DHCP*" } } ] } }, } } }'
So then I couldn't work out how to get all results easily. I found if I set size=0 then I got this output:
Code: Select all
{
"took": 7,
"timed_out": false,
"_shards": {
"total": 10,
"successful": 10,
"failed": 0
},
"hits": {
"total": 801835,
"max_score": 0,
"hits": [
]
}
Which tells me I have 801835 results. So then I tried:
Code: Select all
curl -XGET 'http://lsproduction01/nagioslogserver/index.php/api/backend/logstash-2015.09.11,logstash-2015.09.10/_search?pretty&token=c8d0c7a3a064a065339f5f9e21dd7a63e540890d&size=801835' -d '{ "query": { "filtered": { "query": { "bool": { "should": [ { "query_string": { "query": "message:DHCP*" } } ] } }, } } }'
Which did nothing. So I reduced the number to 8000 and it worked, spewing a lot of output on the screen.
I tried adding a -connect-timeout but that did not help. Not sure where to go from here.
The final bit is to output it to a file with
-o /tmp/curl_results.txt
Code: Select all
curl -XGET 'http://lsproduction01/nagioslogserver/index.php/api/backend/logstash-2015.09.11,logstash-2015.09.10/_search?pretty&token=c8d0c7a3a064a065339f5f9e21dd7a63e540890d&size=8000' -d '{ "query": { "filtered": { "query": { "bool": { "should": [ { "query_string": { "query": "message:DHCP*" } } ] } }, } } }' -o /tmp/curl_results.txt
So all you need to do is work out how to get a large number of results to output.
Let us know how this works for you.