1. Installation
You can use the built-in plugin tool of Logstash to install the filter:
bin/logstash-plugin install logstash-filter-rest
2. Filter Configuration
Add the following inside the filter section of your logstash configuration:filter {
rest {
request => {
url => "http://example.com" # string (required, with field reference: "http://example.com?id=%{id}" or params, if defined)
method => "post" # string (optional, default = "get")
headers => { # hash (optional)
"key1" => "value1"
"key2" => "value2"
}
auth => {
user => "AzureDiamond"
password => "hunter2"
}
params => { # hash (optional, available for method => "get" and "post"; if post it will be transformed into body hash and posted as json)
"key1" => "value1"
"key2" => "value2"
"key3" => "%{somefield}" # sprintf is used implicitly
}
}
json => true # boolean (optional, default = true)
target => "my_key" # string (mandatory, no default)
fallback => { # hash describing a default in case of error
"key1" => "value1"
"key2" => "value2"
}
}
}
Reference : https://github.com/lucashenning/logstash-filter-rest

Social Plugin