22 Oct 2025 01:03 PM - last edited on 23 Oct 2025 08:20 AM by
MaciejNeumann
Hi,
I have a JAR file my_jar.jar that is started multiple times with different command line arguments. The argument I want to use to differentiate the instances is:
-Dlog4j2.configurationFile=/var/log/my_jar-xxx/log4j2.xml
My goal is to have each unique my_jar-xxx in its own process group. Currently, I have several process instances with name my_jar.jar grouped together in a single process group.
I tried using an Advanced Detection Rule:
Property: Java Jar
Contains: my_jar.jar
Delimiter from: -Dlog4j2.configurationFile=/var/log/
Delimiter to: /log4j2.xml
and Standalone rule selected
…but it doesn’t work.
I also tried defining a Process Group Naming Rule:
{ProcessGroup:CommandLineArgs/-Dlog4j2\.configurationFile=/var/log/([^/]+?)/log4j2\.xml}
However, with this approach, if I have two processes, e.g., my_jar-test-123 and my_jar-testing-234 in the path, they are both shown with the same name: "my_jar-test-123,my_jar-testing-234"
…and they still end up in a single process group.
Any suggestions on what I might be doing wrong?
Thanks!
Regards, Deni
22 Oct 2025 02:55 PM
Hi,
I would try Declarative process grouping. Keep in mind process must be restarted to apply changes.
Best regards
22 Oct 2025 04:06 PM
Thanks!
I'm trying to configure it with Declarative process grouping, but don't see a way to extract the desired PG name from the command line arguments similar to the Delimiter from and Delimiter to in the Advanced Detection Rule or regexp in the Process Group Naming Rule.
Can you help me with that?
Regards, Deni
22 Oct 2025 08:27 PM
@deni Declarative process grouping works for deep monitored processes only in recent OneAgents >1.307. Previously it was only for non-deep monitored processes.
Anyway, it might be worth using either a custom environment variable or use the DT_CLUSTER_ID (and optionally also DT_NODE_ID) as stated here - https://docs.dynatrace.com/docs/observe/infrastructure-monitoring/process-groups/configuration/pg-de...
Sometimes it's much easier (and futureproof) to set it on the deployment side. You can stil rename it in Dynatrace using process group naming rules.
23 Oct 2025 07:39 AM
Thanks!
Yes, it would definitely be easier on the development side, but in this case the customer has around 50+ hosts, and on each host this JAR is started about 4–5 times. That’s why I’m looking for a solution like this.
The processes are deep monitored and the oneagent version is 1.323.46.20251015-192739.
I still don’t understand why both solutions I tried didn’t work — from what I can see in the documentation, both should have worked?