I am generating a token by using http_poller input plugin, using the generated token in http filter part and splitting the fields from results, Can anyone please suggest me on Pagination.
As the api results are around 4000,
Blockquote
Preformatted text
{
"total": 4425,
"results": [
{
"_id": {
"$oid": "65aac96f90ebf09ba386170e"
},................................................ },................................................
`> Blockquote`
type or paste code here
````Preformatted text`
my logstash pipeline:
input {
http_poller {
urls => {
generatetoken => {
method => post
body => '{ "userID" :"${USER}", "userPWD" : "${PWD}" }'
headers => {
"Content-Type" => "application/json"
}
url => "https://**********/auth/login"
request_timeout => 60
}
}
truststore => "/usr/share/logstash/config/Kafka/cacerts"
truststore_password => "changeit"
schedule => { cron => "* * * * * UTC"}
metadata_target => "my-token"
}
}
filter{
http {
body_format => "json"
follow_redirects => false
verb => "POST"
headers => { "Content-Type" => "application/json"
"Authorization" => "%{token}" }
body => { "appCode" => "*****"}
url => "https://*****"
truststore => "/usr/share/logstash/config/Kafka/cacerts"
truststore_password => "changeit"
target_body => "[api_response]"
# target_headers => "[@metadata][token]"
}
split { field => "[api_response][results]" }
}
elasticsearch {
hosts => ["${ES_HOST}"]
user => "${USER}"
password => "${PWD}"
ilm_enabled => true
ilm_policy => "*****_lifecycle_policy"
ilm_rollover_alias => "${INDEX_ENV}-jobhistory-api"
document_id => "%{[api_response][results][_id][$oid]}"
ssl => true
ssl_certificate_verification => true
cacert => "/usr/share/logstash/config/SSL/${SSL_ENV}/elastic-cert.cer"
}
}`Preformatted text`