Background info:
The objective is to transfer release information of a hardware machine from Balena to Kibana using the following logic:
Balena JSON data > Logstash > Elasticsearch > Kibana
I am stuck in the Logstash part
Questions:
What is the best/easiest way to perform an API call like this in Logstash? What input plugin do I need to use for it?
curl -X GET \
"https://api.balena-cloud.com/v4/release?\$filter=belongs_to__application%20eq%20<APP ID>" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <AUTH_TOKEN>"
Reference: https://www.balena.io/docs/reference/api/resources/release/
Where should I place the authentiation token, <AUTH_TOKEN> in my input plugin?
Note: The curl command that I was executing on the command line was like this:
curl -X GET \
"https://api.balena-cloud.com/v4/release?\$filter=belongs_to__application%20eq%20<APP ID>" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <AUTH_TOKEN>"
Then to do it for Logstash I used the following input plugin solution.
Solution:
input{
http_poller {
urls => {
authentication => {
method => get
user => "myEmailAddress"
password => "myPassword"
url => "https://api.balena-cloud.com/v4/release?$filter=belongs_to__application%20eq%20<APP ID>"
headers => {
"Content-Type" => "application/json"
"Authorization" => "Bearer <AUTH_TOKEN>"
}
}
}
request_timeout => 60
schedule => { every => "5s"}
codec => "json"
}
}
output{
stdout {
codec => rubydebug
}
}
system
(system)
Closed
July 18, 2019, 8:31pm
5
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.