Skip to content

Commit

Permalink
docs: add clarification and add filter in the filters list
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex-Izquierdo committed Feb 15, 2024
1 parent 1f1f9c2 commit a21ef01
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
16 changes: 15 additions & 1 deletion docs/filters.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ Event Filters
- Include and exclude keys from the event object
* - dashes_to_underscores
- This filter changes the dashes in all keys in the payload to be underscore.
* - insert_hosts_to_meta
- This filter inserts the hosts from the event into the meta key within the event
based on a custom path in the event object.

| Events filters can be chained one after the other, and the updated data is
| sent from one filter to the next.
Expand All @@ -30,7 +33,7 @@ Event Filters
| When the rulebook starts the Source plugin it associates the correct filters
| and transforms the data before putting it into the queue.
e.g.
Examples:

.. code-block:: yaml
Expand All @@ -45,6 +48,17 @@ e.g.
exclude_keys: ['*_url', '_links', 'base', 'sender', 'owner', 'user']
- dashes_to_underscores:
.. code-block:: yaml
sources:
- foo.bar.my_custom_source:
url: https://my_custom_source.com
filters:
- ansible.eda.insert_hosts_to_meta:
host_path: "alert.meta.instances"
| In the above example the data is first passed thru the json_filter and then
| thru the dashes_to_underscores filter.
| Keys in the event payload can only contain letters, numbers and underscores.
Expand Down
6 changes: 6 additions & 0 deletions docs/host_limit.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ To accommodate this, the EDA collection provides the `insert_hosts_to_meta` filt
allowing any plugin to customize the value of `event.meta.hosts` based on the contents
of a specific key in the event.

.. note::

The `host_path` in filter `insert_hosts_to_meta` don't expect the `event` root key unlike conditions
or action arguments.


Example:

.. code-block:: yaml
Expand Down

0 comments on commit a21ef01

Please sign in to comment.