From a917b0a272a377c4c99cf454616ba8cae4cc8108 Mon Sep 17 00:00:00 2001 From: Karen Metts Date: Tue, 12 Feb 2019 19:14:02 -0500 Subject: [PATCH 1/2] Add placeholder for code sample --- docs/index.asciidoc | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/docs/index.asciidoc b/docs/index.asciidoc index c97020e..2423b38 100644 --- a/docs/index.asciidoc +++ b/docs/index.asciidoc @@ -20,7 +20,31 @@ include::{include_path}/plugin_header.asciidoc[] ==== Description -The HTTP filter provides integration with external web services/REST APIs. +The HTTP filter integrates with external web services/REST APIs, and enables +lookup enrichment against any HTTP service or endpoint. This plugin is well +suited for many enrichment use cases, such as social APIs, sentiment APIs, +security feed APIs, and business service APIs. ++ +TODO: TEST/VERIFY EXAMPLE ++ +[source,txt] +----- +filter { + http { + url => "http://example.com" + verb => GET + body => { + "user-id" => "%{user}" + "api-key" => "%{api_key}" + } + body_format => "json" + headers => + "Content-type" => "application/json" + } + target_body => "new_field" + } +} +----- [id="plugins-{type}s-{plugin}-options"] ==== HTTP Filter Configuration Options From bdf7c254cedca858b644501d84b702f57521404d Mon Sep 17 00:00:00 2001 From: Karen Metts Date: Thu, 14 Mar 2019 20:46:32 -0400 Subject: [PATCH 2/2] Add example to http filter --- docs/index.asciidoc | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/docs/index.asciidoc b/docs/index.asciidoc index 2423b38..de97eea 100644 --- a/docs/index.asciidoc +++ b/docs/index.asciidoc @@ -24,26 +24,32 @@ The HTTP filter integrates with external web services/REST APIs, and enables lookup enrichment against any HTTP service or endpoint. This plugin is well suited for many enrichment use cases, such as social APIs, sentiment APIs, security feed APIs, and business service APIs. -+ -TODO: TEST/VERIFY EXAMPLE -+ + +*Sample* + [source,txt] ----- -filter { - http { - url => "http://example.com" - verb => GET +http { + url => "https://neutrinoapi.com/convert" body => { - "user-id" => "%{user}" - "api-key" => "%{api_key}" + "user-id" => "auser" + "api-key" => "anapikey" + "from-value" => "%{millimeters}" + "from-type" => "mm" + "to-type" => "inch" } + verb => "POST" body_format => "json" - headers => - "Content-type" => "application/json" - } - target_body => "new_field" + target_body => "neutrinoapi_convert_mm_to_in" + add_tag => ["from_api"] + id => "http-neutrino-lookup" + } + mutate { + # needed because the neutrino response JSON object includes unneeded extra key/values + copy => {"[neutrinoapi_convert_mm_to_in][result]" => "[inches]"} + remove_field => ["neutrinoapi_convert_mm_to_in"] + id => "copy-to-inches" } -} ----- [id="plugins-{type}s-{plugin}-options"]