Describe the issue: I want to use a python script to send multiple queries to OS. However, I get always the most recent log entry. The filter of the query is not applied.
My query is like this:
GET /syslog-*/_search
{
"query": {
"query_string": {
"query": "syslog_program:suricata and fw_name: sws01.*********** and suricata.alert.signature:* and suricata.src_ip:* and suricata.dest_ip:10.10.* and not suricata.src_ip:10.10.*"
}
},
"size": 2,
"sort": [
{
"@timestamp": {
"order": "desc"
}
}
]
}
I want to filter to syslog_program: suricata, but I get all syslog_program values. In case of the screenshot, it is “charon”. The usage of match is not possible, since I have several query strings I iterate. I do not get syntaxt errors, I guess it is more a logical error, but I do not get it.
GET syslog-demo/_search
{
"size": 10,
"sort": [{ "@timestamp": "desc" }],
"query": {
"query_string": {
"query": "syslog_program:\"suricata\" AND fw_name:\"sws01.example\" AND _exists_:suricata.alert.signature AND _exists_:suricata.src_ip AND suricata.dest_ip:\"10.10.0.0/16\" AND NOT suricata.src_ip:\"10.10.0.0/16\""
}
}
}
Do I have to change it in the indexes? I create everyday a new one.
I am wondering that I can use OSD for searching, but not direct on OS level.
(P.S.: suricata creates several dest_ip fields. I am aware of it that I used suricata.alert.dest_ip in the opener)
Edit: Ah, the way to go is to create an ‘index template’ for (in my case) syslog-* and to put the mappings in there. Every new index has the new mappings, right?