-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
filter_lua: add support for Log metadata handling
The current Lua filter only supports the processing of the log body and timestamp per record. Metadata support in logs was added recently and this patch extends the filter with a new function prototype and return values to provide metadata manipulation capabilities. The new option called 'enable_metadata', boolean (default: off) allows to use a new prototype for the Lua script which in a new argument receives the metadata as a Lua table, similar concept as the log body is received. The following is an example of the use of this new functionality: pipeline: inputs: - name: dummy processors: logs: - name: lua enable_metadata: true call: test_v2 code: | function test_v2(tag, timestamp, metadata, body) metadata['meta_test'] = 'ok' body['body_test'] = 'ok' return 2, timestamp, metadata, body end outputs: - name : stdout match: '*' For this type of function, is mandatory to return the metadata table, either a new one or an updated version. Signed-off-by: Eduardo Silva <[email protected]>
- Loading branch information
Showing
2 changed files
with
122 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters