Skip to content

Relabel from path #388

Open
Open
@andreymal

Description

@andreymal

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
  }
}

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions