suvitt
(Suvitt Walve)
March 27, 2017, 5:37pm
1
Hi All,
I am not able to send additional headers in the http POST request.
yml file
heartbeat.monitors:
type: http
List or urls to query
#urls:
urls: ["http://localhost:8724/service/XXX/YYY "]
request details:
check.request.method: POST
check.request.headers: 'soapaction': '/Processes/XXXX'
check.request.body: 'XXX'
Configure task schedule
schedule: '@every 10s'
Able to see the body in the request received by the service but the header is not sent.
Any help is appreciated.
steffens
(Steffen Siering)
March 28, 2017, 8:44am
2
Can you try with newline like this?
heartbeat.monitors:
- type: http
# List or urls to query
urls: ["http://localhost:8724/service/XXX/YYY"]
# request details:
check.request.method: POST
check.request.headers:
soapaction: '/Processes/XXXX'
check.request.body: 'XXX'
# Configure task schedule
schedule: '@every 10s'
Can you share the debug log from starting heartbeat in foreground with -e -d '*,config'
?
Did you check with wireshark the header is missing?
suvitt
(Suvitt Walve)
March 28, 2017, 8:39pm
3
Hi Steffen,
Thank you. The new line helped fix the issue.
here is the updated Config I used with multiple elements in header defined for URL.
#URL :
urls: ["http://localhost:9394/service/XXX/YYY"]
# request details:
check.request.method: POST
check.request.headers:
soapaction: '/Processes/XXX'
content-type: 'text/xml;charset=UTF-8'
check.request.body: 'XXXXX'
Is it possible to define multiple URL's and each URL having unique set of additional headers and body? How would we define this.
Thank you.
Suvitt
steffens
(Steffen Siering)
March 29, 2017, 9:05am
4
this is not possible. You basically want/need to define multiple monitors. Using dynamic reloading feature in heartbeat, you can have multiple json objects with url + headers/body. But note, dynamic reloading as is will change to match reloading functionality in filebeat/metricbeat in the future.
suvitt
(Suvitt Walve)
March 30, 2017, 3:36pm
5
Hi Steffen,
Thanks , defining multiple monitors did the trick.
here is the sample I used.
heartbeat.monitors:
- type: http
##Sample SOAP/HTTP
urls: ["http://localhost:8724/service/XXX/YYY"]
check.request.method: POST
check.request.headers:
soapaction: '/Processes/XXXX'
accept-encoding: 'gzip,deflate'
content-type: 'text/xml;charset=UTF-8'
check.request.body: '<SOAP message>'
schedule: '@every 10s'
- type: http
##Sample rest api
urls: ["http://localhost:8725/api/XXX/YYY"]
check.request.method: POST
check.request.headers:
content-type: 'application/json'
accept-encoding: 'gzip,deflate'
check.request.body: '<json message>'
schedule: '@every 10s'
Thanks for the help.
steffens
(Steffen Siering)
March 31, 2017, 12:02pm
6
One more tip: you might want to 'indicate' the different monitoring types for filtering in Kibana (or via Elasticsearch API). In the future you might be able to make use of this (open ticket) , but for now using name
will set the event type
field to the name configured (to be improved according to this ticket )
system
(system)
Closed
April 28, 2017, 12:03pm
7
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.