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
}
}
I have a nginx configuration similar to:
It would be handy to be able to extract the application name from the log file path. Something like this: