forked from opensearch-project/documentation-website
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add CIDR and User Agent processors (opensearch-project#4585)
* Add CIDR and User Agent processors Signed-off-by: Naarcha-AWS <[email protected]> * Add CIDR functions Signed-off-by: Naarcha-AWS <[email protected]> * Fix typos Signed-off-by: Naarcha-AWS <[email protected]> * Add technical feedback Signed-off-by: Naarcha-AWS <[email protected]> * Update user-agent.md Signed-off-by: Naarcha-AWS <[email protected]> * Apply suggestions from code review Co-authored-by: Chris Moore <[email protected]> Signed-off-by: Naarcha-AWS <[email protected]> * Update _data-prepper/pipelines/expression-syntax.md Co-authored-by: Hai Yan <[email protected]> Signed-off-by: Naarcha-AWS <[email protected]> * Apply suggestions from code review Co-authored-by: Nathan Bower <[email protected]> Signed-off-by: Naarcha-AWS <[email protected]> * Update user-agent.md Signed-off-by: Naarcha-AWS <[email protected]> --------- Signed-off-by: Naarcha-AWS <[email protected]> Signed-off-by: Naarcha-AWS <[email protected]> Co-authored-by: Chris Moore <[email protected]> Co-authored-by: Hai Yan <[email protected]> Co-authored-by: Nathan Bower <[email protected]>
- Loading branch information
1 parent
a8fb527
commit 8d1e654
Showing
2 changed files
with
100 additions
and
0 deletions.
There are no files selected for viewing
63 changes: 63 additions & 0 deletions
63
_data-prepper/pipelines/configuration/processors/user-agent.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,63 @@ | ||
--- | ||
layout: default | ||
title: user_agent | ||
parent: Processors | ||
grand_parent: Pipelines | ||
nav_order: 130 | ||
--- | ||
|
||
# user_agent | ||
|
||
The `user_agent` processor parses any user agent (UA) string in an event and then adds the parsing results to the event's write data. | ||
|
||
## Usage | ||
|
||
In this example, the `user_agent` processor calls the source that contains the UA string, the `ua` field, and indicates the key to which the parsed string will write, `user_agent`, as shown in the following example: | ||
|
||
```yaml | ||
processor: | ||
- user_agent: | ||
source: "ua" | ||
target: "user_agent" | ||
``` | ||
The following example event contains the `ua` field with a string that provides information about a user: | ||
|
||
```json | ||
{ | ||
"ua": "Mozilla/5.0 (iPhone; CPU iPhone OS 13_5_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.1 Mobile/15E148 Safari/604.1" | ||
} | ||
``` | ||
|
||
The `user_agent` processor parses the string into a format compatible with Elastic Common Schema (ECS) and then adds the result to the specified target, as shown in the following example: | ||
|
||
```json | ||
{ | ||
"user_agent": { | ||
"original": "Mozilla/5.0 (iPhone; CPU iPhone OS 13_5_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.1 Mobile/15E148 Safari/604.1", | ||
"os": { | ||
"version": "13.5.1", | ||
"full": "iOS 13.5.1", | ||
"name": "iOS" | ||
}, | ||
"name": "Mobile Safari", | ||
"version": "13.1.1", | ||
"device": { | ||
"name": "iPhone" | ||
} | ||
}, | ||
"ua": "Mozilla/5.0 (iPhone; CPU iPhone OS 13_5_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.1 Mobile/15E148 Safari/604.1" | ||
} | ||
``` | ||
|
||
## Configuration options | ||
|
||
You can use the following configuration options with the `user_agent` processor. | ||
|
||
| Option | Required | Description | | ||
| :--- | :--- | :--- | | ||
| `source` | Yes | The field in the event that will be parsed. | ||
| `target` | No | The field to which the parsed event will write. Default is `user_agent`. | ||
| `exclude_original` | No | Determines whether to exclude the original UA string from the parsing result. Defaults to `false`. | ||
| `cache_size` | No | The cache size of the parser in megabytes. Defaults to `1000`. | | ||
| `tags_on_parse_failure` | No | The tag to add to an event if the `user_agent` processor fails to parse the UA string. | |
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