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

Relabel from path #388

Open
andreymal opened this issue May 7, 2024 · 0 comments
Open

Relabel from path #388

andreymal opened this issue May 7, 2024 · 0 comments

Comments

@andreymal
Copy link

I have a nginx configuration similar to:

server {
  # ...
  access_log /var/log/nginx/app1/access.log;
}

server {
  # ...
  access_log /var/log/nginx/app2/access.log;
}

It would be handy to be able to extract the application name from the log file path. Something like this:

namespace "nginx" {
  source = {
    files = [
      "/var/log/nginx/access.log",
      "/var/log/nginx/*/access.log",
    ]
  }

  relabel "app" {
    from = "log_path"

    match "^/var/log/nginx/(.+?)/access\\.log$" {
      replacement = "$1"
    }

    # ... and maybe a fallback value like "other" if no matches found
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant