Using regex to make logs looks cleaner

Hi all, we’ve already established our grafana loki server and promtail agents which are feeding our loki server their logs. While our loki server are already getting logs from the agents, we would to make logs more nicer. Our loki is getting logs from the nginx logs with multiple vhosts and with multiple domains, is there a way to only output the name of the sites and exclude directory location of the vhosts (/var/log/**/*.log)?(e.g. output = site1.domain, site2.domain).

{job=“nginx”, filename="/var/www/**/*.log"}

Thanks!

2 Likes