I want to monitor httpd by Grafana process monitoring and using below matcher in alloy.conf file. but when trying prometheus query, it is showing total count as 12(including rotatelogs which contains the word httpd) do anybody knows how to fix it?
rotatelogs may be getting matched because your cmdline regex matches any process whose command line contains that pattern, not just the httpd processes.
If your Apache processes have comm=httpd, you can make the matcher more specific by matching both the process name and the command line:
matcher {
name = "Apache"
comm = ["httpd"]
cmdline = [".*httpd.conf -E /opt/middleware/httpd/instances/mkweb.*"]
}
This assumes the actual process name (comm) for your Apache processes is httpd. If you’re not sure, verify it with:
ps -eo pid,comm,args | grep -i httpd
Check the comm column. If it differs from httpd, use the value it reports instead.
Thanks for the prompt response Sir, but that did not worked. still showing count along with rotatelogs despite mentioned comm and cmdline in alloy.river file. PFB current config.
matcher {
name = “Apache”
comm = [“httpd”]
cmdline = [“.*httpd.conf -E /opt/middleware/httpd/instances/mkweb.*”]
}
According to the official process-exporter documentation, when a matcher contains multiple selector types (comm, exe, cmdline), all selector types must match (AND logic). Within a selector like comm = [...], multiple values are combined using logical OR. So:
comm = ["httpd"]
cmdline = [".*httpd.conf -E /opt/middleware/httpd/instances/mkweb.*"]
should already exclude rotatelogs, provided its comm is not httpd.
Could you share the output of:
ps -eo pid,comm,args | grep -E 'httpd|rotatelogs'
(If your ps doesn’t support args, use cmd instead.)
This will tell us whether:
rotatelogs is actually reporting comm=httpd (which would explain why it’s matching), or
it has a different comm, in which case the Alloy configuration may not have been reloaded correctly or the configuration being applied differs from what was posted.
Also worth double-checking your pasted config uses curly quotes ("Apache") → if your actual .river file has these too, it would break parsing. Retype them as straight quotes and restart Alloy if so.