A filter resource represents an instance of a filter inside MaxScale. Multiple
services can use the same filter and a single service can use multiple filters.
Create a new filter. The posted object must define at
least the following fields.
data.id
Name of the filter
data.type
Type of the object, must be filters
data.attributes.module
The filter module to use
All of the filter parameters should be defined at creation time in thedata.attributes.parameters object.
As the service to filter relationship is ordered (filters are applied in the
order they are listed), filter to service relationships cannot be defined at
creation time.
The following example defines a request body which creates a new filter.
{
"data": {
"id": "test-filter", // Name of the filter
"type": "filters",
"attributes": {
"module": "qlafilter", // The filter uses the qlafilter module
"parameters": { // Filter parameters
"filebase": "/tmp/qla.log"
}
}
}
}
Response
Filter is created:
Status: 204 No Content
Update a filter
PATCH /v1/filters/:name
Filter parameters can be updated at runtime if the module supports it. Refer to
the individual module documentation for more details on whether it supports
runtime configuration and which parameters can be updated.
The following example modifies a filter by changing the match parameter to.*users.*.
The :filter in the URI must map to the name of the filter to be destroyed.
A filter can only be destroyed if no service uses it. This means that thedata.relationships object for the filter must be empty. Note that the service
→ filter relationship cannot be modified from the filters resource and must be
done via the services resource.
This endpoint also supports the force=yes parameter that will unconditionally
delete the filter by first removing it from all services that it uses.