Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add RegexSet support to regex #2469

Closed
Hoverbear opened this issue Apr 27, 2020 · 0 comments · Fixed by #2493
Closed

Add RegexSet support to regex #2469

Hoverbear opened this issue Apr 27, 2020 · 0 comments · Fixed by #2493
Labels
domain: transforms Anything related to Vector's transform components needs: approval Needs review & approval before work can begin.

Comments

@Hoverbear
Copy link
Contributor

Hoverbear commented Apr 27, 2020

This is a more specific form of #1477. (and thus related to #2418)

Add RegexSet support to the regex_parser transform.

The docs for RegexSet are: https://docs.rs/regex/1.3.7/regex/struct.RegexSet.html

This would allow users to match over multiple regexes efficiently and save them some configuration woes.

[transforms.<transform-id>]
  type = "regex_parser"
  field = "message"
  regexes = [
     '^(?P<host>[\w\.]+) - (?P<user>[\w]+) (?P<bytes_in>[\d]+) \[(?P<timestamp>.*)\] "(?P<method>[\w]+) (?P<path>.*)" (?P<status>[\d]+) (?P<bytes_out>[\d]+)$',
     '^(?P<host>[\w\.]+) - (?P<user>[\w]+) (?P<bytes_in>[\d]+) \[(?P<timestamp>.*)\] "(?P<method>[\w]+) (?P<path>.*)" (?P<status>[\d]+) (?P<bytes_out>[\d]+)$',
     '^(?P<host>[\w\.]+) - (?P<user>[\w]+) (?P<bytes_in>[\d]+) \[(?P<timestamp>.*)\] "(?P<method>[\w]+) (?P<path>.*)" (?P<status>[\d]+) (?P<bytes_out>[\d]+)$',
  ]

[transforms.<transform-id>.types]
  bytes_in = "int"
  timestamp = "timestamp|%d/%m/%Y:%H:%M:%S %z"
  status = "int"
  bytes_out = "int"
@Hoverbear Hoverbear changed the title RegexSet support to regex Add RegexSet support to regex Apr 27, 2020
@Hoverbear Hoverbear added domain: transforms Anything related to Vector's transform components needs: approval Needs review & approval before work can begin. transform: regex_parser labels Apr 27, 2020
mre added a commit to mre/vector that referenced this issue Apr 29, 2020
…ixes vectordotdev#2469)

This allows to specify multiple regular expressions to be defined
that will be matched on the input using regex::RegexSet.

Signed-off-by: Matthias Endler <[email protected]>
mre added a commit to mre/vector that referenced this issue Apr 29, 2020
…ixes vectordotdev#2469)

This allows to specify multiple regular expressions to be defined
that will be matched on the input using regex::RegexSet.

Signed-off-by: Matthias Endler <[email protected]>
mre added a commit to mre/vector that referenced this issue Apr 29, 2020
…ixes vectordotdev#2469)

This allows to specify multiple regular expressions to be defined
that will be matched on the input using regex::RegexSet.

Signed-off-by: Matthias Endler <[email protected]>
mre added a commit to mre/vector that referenced this issue Apr 29, 2020
…ixes vectordotdev#2469)

This allows to specify multiple regular expressions to be defined
that will be matched on the input using regex::RegexSet.

Signed-off-by: Matthias Endler <[email protected]>
mre added a commit to mre/vector that referenced this issue Apr 29, 2020
…ixes vectordotdev#2469)

This allows to specify multiple regular expressions to be defined
that will be matched on the input using regex::RegexSet.

Signed-off-by: Matthias Endler <[email protected]>
mre added a commit to mre/vector that referenced this issue Apr 29, 2020
…ixes vectordotdev#2469)

This allows to specify multiple regular expressions to be defined
that will be matched on the input using regex::RegexSet.

Signed-off-by: Matthias Endler <[email protected]>
mre added a commit to mre/vector that referenced this issue Apr 29, 2020
…ixes vectordotdev#2469)

This allows to specify multiple regular expressions to be defined
that will be matched on the input using regex::RegexSet.

Signed-off-by: Matthias Endler <[email protected]>
mre added a commit to mre/vector that referenced this issue May 4, 2020
…ixes vectordotdev#2469)

This allows to specify multiple regular expressions to be defined
that will be matched on the input using regex::RegexSet.

Signed-off-by: Matthias Endler <[email protected]>
mre added a commit to mre/vector that referenced this issue May 4, 2020
…ixes vectordotdev#2469)

This allows to specify multiple regular expressions to be defined
that will be matched on the input using regex::RegexSet.

Signed-off-by: Matthias Endler <[email protected]>
mre added a commit to mre/vector that referenced this issue May 12, 2020
…dev#2469)

This allows to specify multiple regular expression patterns
to be defined that will be matched on the input using
`regex::RegexSet`.

Signed-off-by: Matthias Endler <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain: transforms Anything related to Vector's transform components needs: approval Needs review & approval before work can begin.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant