I want to retrieve logs from a server using http_poller plugin but I need to set some vars in the header request. Then, I need to execute the ruby code and use the vars in the input of conf file
**api_key** = '27c59....beb28'
api_secret = '15db2.....b682ec'
**data** = 'thedata'
**timestamp** = DateTime.now.strftime('%s')
text_to_hash = api_key << data << String(timestamp)
digest = OpenSSL::Digest.new('SHA256')
**hash** = OpenSSL::HMAC.hexdigest(digest, api_secret, text_to_hash)
conf File
input {
http_poller {
urls => {
api2 => {
url => "the_endpoint"
method => post
headers => {
"Content-Type" => "application/json"
"x-ltd-apikey" => <**api_key**>
"x-ltd-sign" => <**hash**>
"x-ltd-timestamp" => <**timestamp**>
}
body => <**data**>
}
}
schedule => {
"in" => "1s"
}
}
}
Do you have some idea?