Skip to content

Commit

Permalink
add documentation for UserAgent converter
Browse files Browse the repository at this point in the history
  • Loading branch information
pchila committed Jul 23, 2024
1 parent 186f7b3 commit b63cd55
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions pkg/ottl/ottlfuncs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,7 @@ Available Converters:
- [UnixMilli](#unixmilli)
- [UnixNano](#unixnano)
- [UnixSeconds](#unixseconds)
- [UserAgent](#useragent)
- [UUID](#UUID)
- [Year](#year)

Expand Down Expand Up @@ -1416,6 +1417,31 @@ Examples:

- `UnixSeconds(Time("02/04/2023", "%m/%d/%Y"))`

### UserAgent

`UserAgent(value)`

The `UserAgent` Converter parses the string argument trying to match it against well-known user-agent strings as defined
[here](https://github.com/ua-parser/uap-core/blob/master/regexes.yaml)

The results of the parsing are returned as a map containing `user_agent.name`, `user_agent.version` and `user_agent.original`
as defined in semconv v1.25.0.

Examples:

- `UserAgent("curl/7.81.0")`
```yaml
"user_agent.name": "curl"
"user_agent.version": "7.81.0"
"user_agent.original": "curl/7.81.0"
```
- `Mozilla/5.0 (X11; Linux x86_64; rv:126.0) Gecko/20100101 Firefox/126.0`
```yaml
"user_agent.name": "Firefox"
"user_agent.version": "126.0"
"user_agent.original": "Mozilla/5.0 (X11; Linux x86_64; rv:126.0) Gecko/20100101 Firefox/126.0"
```

### URL

`URL(url_string)`
Expand Down

0 comments on commit b63cd55

Please sign in to comment.