Hi Community! I hope you're doing great
I'm struggling to give a 5 seconds window/interval of time between each document inserted to elasticsearch in the timestamp field.
Actually, I have this pipeline:
input {
http_poller {
urls => {
url => "http://localhost:5000/post/1"
}
request_timeout => 60
schedule => { every => "5m"}
codec => "json"
metadata_target => "http_poller_metadata"
}
}
output {
elasticsearch {
index => "weather"
hosts => [ "https://elasticsearch:9200" ]
user => "${ELASTIC_USERNAME}"
password => "${ELASTIC_PASSWORD}"
ssl => true
ssl_certificate_verification => true
cacert => '/certs/ca.crt'
codec => json_lines
}
stdout {}
}
Receiving into elasticsearch, documents such as:
{
"is_successful": false,
"@timestamp": "2021-04-20T22:42:08.276Z",
"ip_address": "0.0.0.1",
}, {
"is_successful": false,
"@timestamp": "2021-04-20T22:42:08.276Z",
"ip_address": "0.0.0.2",
}, {
"is_successful": true,
"@timestamp": "2021-04-20T22:42:08.276Z",
"ip_address": "0.0.0.3",
}
So I would like to have 5 seconds in between each @timestamp
. Such as:
{
"is_successful": false,
"@timestamp": "2021-04-20T22:42:08.276Z",
"ip_address": "0.0.0.1",
}, {
"is_successful": false,
"@timestamp": "2021-04-20T22:42:13.276Z",
"ip_address": "0.0.0.2",
}, {
"is_successful": true,
"@timestamp": "2021-04-20T22:42:18.276Z",
"ip_address": "0.0.0.3",
}
How could I achieve this? any tip to solve it?
Thank you in advance!