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

Feature Request: Allow regular expressions in prospector paths and extract to metadata #7024

Closed
DanielYWoo opened this issue May 5, 2018 · 6 comments

Comments

@DanielYWoo
Copy link

DanielYWoo commented May 5, 2018

We have 800+ applications and trying to migrate to beat. The problem is that our log files are in a standard pattern, e,g.

/opt/logs/<env>/<application_name>/<log_type>.log

We have so many applications that we don't want to specify a prospector for each of those applications, we want to set up a single prospector, with a regular expression pattern instead of glob-pattern, to extract , and into metadata as fields like @metadata.env, @metadata.application_name and @metadata.log_type.

Another option is to write our own processor to handle this but that's not a general solution, if we change our file pattern we have to compile the processor and deploy again. So it's best to support regular expression in prospector paths.

@ph
Copy link
Contributor

ph commented May 5, 2018

Hello, we are not planning to add regular expression as a processor, but we plan to have dissect which will allow to tokenize this string.

We have a PR at #6925

@DanielYWoo
Copy link
Author

@ph #6925 is to extract information from the log message. My problem is to extract information from the file path and name.

@ph
Copy link
Contributor

ph commented May 7, 2018

@DanielYWoo The Dissect processor will allow you to target any fields, so in your case you will target the source field of the event which contains /opt/logs/<env>/<application_name>/<log_type>.log and extract the information with a token similar to this

token: "/opt/logs/%{env}/%{application_name}/%{log_type}.log"
example string: "/opt/logs/production/myapp/web.log"

This will generate the following fields:

  env: "production"
  application_name: "myapp"
  log_type: "web"

@ph
Copy link
Contributor

ph commented May 7, 2018

@DanielYWoo I have added a complete example to my previous comment.

@ph
Copy link
Contributor

ph commented May 8, 2018

I will close this for now, @DanielYWoo feel free to reopen it if you think dissect cannot solve your use case.

@ph ph closed this as completed May 8, 2018
@DanielYWoo
Copy link
Author

Thanks, got it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants