Skip to content

Commit c6de7f2

Browse files
authored
add body config and ES example
details around manticore's `body` capability, and an example of using it to query elasticsearch in a way that logstash-inputs-elasticsearch cannot (ie with aggs)
1 parent 5476a5c commit c6de7f2

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

docs/index.asciidoc

+31-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ output {
6262
}
6363
----------------------------------
6464

65-
Using the HTTP poller with custom a custom CA or self signed cert.
65+
==== Using the HTTP poller with custom a custom CA or self signed cert.
6666

6767
If you have a self signed cert you will need to convert your server's certificate to a valid# `.jks` or `.p12` file. An easy way to do it is to run the following one-liner, substituting your server's URL for the placeholder `MYURL` and `MYPORT`.
6868

@@ -86,6 +86,27 @@ The above snippet will create two files `downloaded_cert.pem` and `downloaded_tr
8686
}
8787
----------------------------------
8888

89+
==== Using Http_poller to query Elasticsearch
90+
91+
This plugin can be used to send a request body to Elasticsearch then process the response. This is especially useful for getting aggregation results.
92+
93+
[source,ruby]
94+
----------------------------------
95+
http_poller {
96+
urls => {
97+
myESurl => {
98+
url => "http://localhost:9200/metricbeat-*/_search"
99+
body => '{"aggs":{"1":{"avg":{"field":"system.cpu.total.pct"}}},"size":0,"query":{"bool":{"must":[{"range":{"@timestamp":{"gte":"now-10m/m","lte":"now/m"}}}]}}}'
100+
method => post
101+
headers => {
102+
"Content-Type" => "application/json"
103+
}
104+
}
105+
}
106+
schedule => { every => "10m" }
107+
}
108+
----------------------------------
109+
89110

90111
[id="plugins-{type}s-{plugin}-options"]
91112
==== Http_poller Input Configuration Options
@@ -98,6 +119,7 @@ This plugin supports the following configuration options plus the <<plugins-{typ
98119
| <<plugins-{type}s-{plugin}-user>> |<<string,string>>|no
99120
| <<plugins-{type}s-{plugin}-password>> |<<password,password>>|No
100121
| <<plugins-{type}s-{plugin}-automatic_retries>> |<<number,number>>|No
122+
| <<plugins-{type}s-{plugin}-body>> |<<string,string>>|no
101123
| <<plugins-{type}s-{plugin}-cacert>> |a valid filesystem path|No
102124
| <<plugins-{type}s-{plugin}-client_cert>> |a valid filesystem path|No
103125
| <<plugins-{type}s-{plugin}-client_key>> |a valid filesystem path|No
@@ -156,6 +178,14 @@ How many times should the client retry a failing URL. We highly recommend NOT se
156178
to zero if keepalive is enabled. Some servers incorrectly end keepalives early requiring a retry!
157179
Note: if `retry_non_idempotent` is set only GET, HEAD, PUT, DELETE, OPTIONS, and TRACE requests will be retried.
158180

181+
id="plugins-{type}s-{plugin}-body"]
182+
===== `body`
183+
184+
* Value type is <<string,string>>
185+
* There is no default value for this setting.
186+
187+
Request body to send with each request. Note that you must set this per-URL.
188+
159189
[id="plugins-{type}s-{plugin}-cacert"]
160190
===== `cacert`
161191

0 commit comments

Comments
 (0)