The Memcached filter provides integration with external data in Memcached.
It currently provides the following facilities:
- get
: get values for one or more memcached keys and inject them into the event at the provided paths
- set
: set values from the event to the corresponding memcached keys
This plugin supports the following configuration options plus the [plugins-filters-memcached-common-options] described later.
Setting | Input type | Required |
---|---|---|
No |
||
No |
||
No |
||
No |
||
No |
Also see [plugins-filters-memcached-common-options] for a list of options supported by all filter plugins.
-
Value type is array
-
Default value is
localhost
The hosts
parameter accepts an array of addresses corresponding to memcached instances.
Hosts can be specified via FQDN (e.g., example.com
), an IPV4 address (e.g., 123.45.67.89
), or an IPV6 address (e.g. ::1
or 2001:0db8:85a3:0000:0000:8a2e:0370:7334
).
If your memcached host uses a non-standard port, the port can be specified by appending a colon (:
) and the port number; to include a port with an IPv6 address, the address must first be wrapped in square-brackets ([
and ]
), e.g., [::1]:11211
.
If more than one host is specified, requests will be distributed to the given hosts using a modulus of the CRC-32 checksum of each key.
-
Value type is string
-
There is no default value for this setting.
If specified, prefix all memcached keys with the given string followed by a colon (:
); this is useful if all keys being used by this plugin share a common prefix.
EXAMPLE:
In the following configuration, we would GET fruit:banana
and fruit:apple
from memcached:
filter { memcached { namespace => "fruit" get { "banana" => "[fruit-stats][banana]" "apple" => "[fruit-stats][apple] } } }
-
Value type is map
-
There is no default value for this setting.
If specified, get the values for the given keys from memcached, and store them in the corresponding fields on the event.
-
keys are interpolated (e.g., if the event has a field
foo
with valuebar
, the keysand/%{foo}
will evaluate tosand/bar
) -
fields can be nested references
filter { memcached { get { "memcached-key-1" => "field1" "memcached-key-2" => "[nested][field2]" } } }
-
Value type is hash
-
There is no default value for this setting.
If specified, extracts the values from the given event fields, and sets the corresponding keys to those values in memcached with the configured ttl
-
keys are interpolated (e.g., if the event has a field
foo
with valuebar
, the keysand/%{foo}
will evaluate tosand/bar
) -
fields can be nested references
filter { memcached { set { "field1" => "memcached-key-1" "[nested][field2]" => "memcached-key-2" } } }