-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #81 from axoflow/filterx-4.9-updates
Filterx 4.9 updates
- Loading branch information
Showing
20 changed files
with
611 additions
and
59 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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
--- | ||
title: "Metrics" | ||
weight: 1000 | ||
--- | ||
<!-- This file is under the copyright of Axoflow, and licensed under Apache License 2.0, except for using the Axoflow and AxoSyslog trademarks. --> | ||
|
||
{{< include-headless "chunk/filterx-experimental-banner.md" >}} | ||
|
||
Available in {{< product >}} 4.9 and later. | ||
|
||
Updates a labeled metric counter, similarly to the [`metrics-probe()` parser]({{< relref "/chapter-parsers/metrics-probe/_index.md" >}}). For details, see {{% xref "/filterx/filterx-metrics/_index.md" %}}. | ||
|
||
You can use `update_metric` to count the processed messages, and create labeled metric counters based on the fields of the processed messages. | ||
|
||
You can configure the name of the counter to update and the labels to add. The name of the counter is an unnamed, mandatory option. Note that the name is automatically prefixed with the `syslogng_` string. For example: | ||
|
||
```json | ||
update_metric( | ||
"my_counter_name", | ||
labels={ | ||
"host": ${HOST}, | ||
"app": ${PROGRAM}, | ||
"id": ${SOURCE} | ||
} | ||
); | ||
``` | ||
|
||
This results in counters like: | ||
|
||
```shell | ||
syslogng_my_counter_name{app="example-app", host="localhost", source="s_local_1"} 3 | ||
``` | ||
|
||
## Options | ||
|
||
### increment | ||
|
||
| | | | ||
| -------- | ------- | | ||
| Type: | integer or variable | | ||
| Default: | 1 | | ||
|
||
An integer, or an expression that resolves to an integer that defines the increment of the counter. The following example defines a counter called `syslogng_input_event_bytes_total`, and increases its value with the size of the incoming message (in bytes). | ||
|
||
```shell | ||
update_metric( | ||
"input_event_bytes_total", | ||
labels={ | ||
"host": ${HOST}, | ||
"app": ${PROGRAM}, | ||
"id": ${SOURCE} | ||
}, | ||
increment=${RAWMSG_SIZE} | ||
); | ||
``` | ||
|
||
### labels | ||
|
||
| | | | ||
| -------- | ------- | | ||
| Type: | dict | | ||
| Default: | `{}` | | ||
|
||
The labels used to create separate counters, based on the fields of the messages processed by `update_metric`. Use the following format: | ||
|
||
```shell | ||
labels( | ||
{ | ||
"name-of-label1": "value-of-the-label1", | ||
... , | ||
"name-of-labelx": "value-of-the-labelx" | ||
} | ||
) | ||
``` | ||
|
||
## level | ||
|
||
| | | | ||
| -------- | ------- | | ||
| Type: | integer (0-3) | | ||
| Default: | 0 | | ||
|
||
Sets the stats level of the generated metrics. | ||
|
||
> Note: Drivers configured with `internal(yes)` register their metrics on level 3. That way if you are creating an SCL, you can disable the built-in metrics of the driver, and create metrics manually using `update_metric`. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
--- | ||
title: "CEF" | ||
weight: 100 | ||
--- | ||
<!-- This file is under the copyright of Axoflow, and licensed under Apache License 2.0, except for using the Axoflow and AxoSyslog trademarks. --> | ||
|
||
{{< include-headless "chunk/filterx-experimental-banner.md" >}} | ||
|
||
Available in {{< product >}} 4.9 and later. | ||
|
||
The `parse_cef` FilterX function parses messages formatted in the [Common Event Format (CEF)](https://www.microfocus.com/documentation/arcsight/arcsight-smartconnectors-8.3/cef-implementation-standard/Content/CEF/Chapter%201%20What%20is%20CEF.htm). | ||
|
||
## Declaration | ||
|
||
Usage: `parse_cef(<input-string>, value_separator="=", pair_separator="|")` | ||
|
||
The first argument is the input message. Optionally, you can set the `pair_separator` and `value_separator` arguments to override their default values. | ||
|
||
The `value_separator` must be a single-character string. The `pair_separator` can be a regular string. | ||
|
||
## Example | ||
|
||
The following is a CEF-formatted message including mandatory and custom (extension) fields: | ||
|
||
```shell | ||
CEF:0|KasperskyLab|SecurityCenter|13.2.0.1511|KLPRCI_TaskState|Completed successfully|1|foo=foo bar=bar baz=test | ||
``` | ||
|
||
The following FilterX expression parses it and converts it into JSON format: | ||
|
||
```shell | ||
filterx { | ||
${PARSED_MESSAGE} = json(parse_cef(${MESSAGE})); | ||
}; | ||
``` | ||
|
||
The content of the JSON object for this message will be: | ||
|
||
```json | ||
{ | ||
"version":"0", | ||
"device_vendor":"KasperskyLab", | ||
"device_product":"SecurityCenter", | ||
"device_version":"13.2.0.1511", | ||
"device_event_class_id":"KLPRCI_TaskState", | ||
"name":"Completed successfully", | ||
"agent_severity":"1", | ||
"extensions": { | ||
"foo":"foo=bar", | ||
"bar":"bar=baz", | ||
"baz":"test" | ||
} | ||
} | ||
``` |
15 changes: 15 additions & 0 deletions
15
content/filterx/filterx-parsing/cef/cef-parser-options/_index.md
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
title: "Options of CEF parsers" | ||
weight: 100 | ||
--- | ||
<!-- This file is under the copyright of Axoflow, and licensed under Apache License 2.0, except for using the Axoflow and AxoSyslog trademarks. --> | ||
|
||
The `parse_cef` FilterX function has the following options. | ||
|
||
## pair_separator | ||
|
||
Specifies the character or string that separates the key-value pairs in the extensions. Default value: ` ` (space). | ||
|
||
## value_separator | ||
|
||
Specifies the character that separates the keys from the values in the extensions. Default value: `=`. |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
--- | ||
title: "LEEF" | ||
weight: 1100 | ||
--- | ||
<!-- This file is under the copyright of Axoflow, and licensed under Apache License 2.0, except for using the Axoflow and AxoSyslog trademarks. --> | ||
|
||
{{< include-headless "chunk/filterx-experimental-banner.md" >}} | ||
|
||
Available in {{< product >}} 4.9 and later. | ||
|
||
The `parse_leef` FilterX function parses messages formatted in the [Log Event Extended Format (LEEF)](https://www.google.com/url?sa=t&source=web&rct=j&opi=89978449&url=https://www.ibm.com/docs/en/dsm%3Ftopic%3Doverview-leef-event-components&ved=2ahUKEwj87cLOjs-JAxUjgf0HHfxyM6AQFnoECBkQAQ&usg=AOvVaw1-YjjgdcnHjZLcJtzB3t6X). | ||
|
||
Both LEEF versions (1.0 and 2.0) are supported. | ||
|
||
## Declaration | ||
|
||
Usage: `parse_leef(<input-string>, value_separator="=", pair_separator="|")` | ||
|
||
The first argument is the input message. Optionally, you can set the `pair_separator` and `value_separator` arguments to override their default values. | ||
|
||
The `value_separator` must be a single-character string. The `pair_separator` can be a regular string. | ||
|
||
## Example | ||
|
||
The following is a LEEF-formatted message including mandatory and custom (extension) fields: | ||
|
||
```shell | ||
LEEF:1.0|Microsoft|MSExchange|4.0 SP1|15345|src=192.0.2.0 dst=172.50.123.1 sev=5cat=anomaly srcPort=81 dstPort=21 usrName=john.smith | ||
``` | ||
|
||
The following FilterX expression parses it and converts it into JSON format: | ||
|
||
```shell | ||
filterx { | ||
${PARSED_MESSAGE} = json(parse_leef(${MESSAGE})); | ||
}; | ||
``` | ||
|
||
The content of the JSON object for this message will be: | ||
|
||
```json | ||
{ | ||
"version":"1.0", | ||
"vendor":"Microsoft", | ||
"product_name":"MSExchange", | ||
"product_version":"4.0 SP1", | ||
"event_id":"15345", | ||
"extensions": { | ||
"src":"192.0.2.0", | ||
"dst":"172.50.123.1", | ||
"sev":"5cat=anomaly", | ||
"srcPort":"81", | ||
"dstPort":"21", | ||
"usrName":"john.smith" | ||
} | ||
} | ||
``` |
17 changes: 17 additions & 0 deletions
17
content/filterx/filterx-parsing/leef/leef-parser-options/_index.md
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
title: "Options of LEEF parsers" | ||
weight: 100 | ||
--- | ||
<!-- This file is under the copyright of Axoflow, and licensed under Apache License 2.0, except for using the Axoflow and AxoSyslog trademarks. --> | ||
|
||
The `parse_leef` FilterX function has the following options. | ||
|
||
## pair_separator | ||
|
||
Specifies the character or string that separates the key-value pairs in the extensions. Default value: `\t` (tab). | ||
|
||
LEEF v2 can specify the separator per message. Omitting this option uses the LEEF v2 provided separator, setting this value overrides it during parsing. | ||
|
||
## value_separator | ||
|
||
Specifies the character that separates the keys from the values in the extensions. Default value: `=`. |
Oops, something went wrong.