# How to split Java processes with the same JAR name but different command-line arguments into separate process groups

**URL:** <https://community.dynatrace.com/t/how-to-split-java-processes-with-the-same-jar-name-but-different-command-line-arguments-into-separate-process-groups/53823>\
**Category:** Open Q&A\
**Tags:** process-groups\
**Created:** [October 22, 2025, 12:03pm UTC](https://community.dynatrace.com/t/how-to-split-java-processes-with-the-same-jar-name-but-different-command-line-arguments-into-separate-process-groups/53823 "2025-10-22T12:03:02Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![deni](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/deni/32/163_2.png) [@deni](https://community.dynatrace.com/u/deni)\
**Post date:** [October 22, 2025, 12:03pm UTC](https://community.dynatrace.com/t/how-to-split-java-processes-with-the-same-jar-name-but-different-command-line-arguments-into-separate-process-groups/53823/1 "2025-10-22T12:03:02Z")

</div>

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:

```markup
-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** :

```markup
{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&nbsp;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

* * *

---

<div class="post-metadata">

**Author:** ![AntonPineiro](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/antonpineiro/32/49_2.png) [@AntonPineiro](https://community.dynatrace.com/u/AntonPineiro)\
**Post date:** [October 22, 2025, 1:55pm UTC](https://community.dynatrace.com/t/how-to-split-java-processes-with-the-same-jar-name-but-different-command-line-arguments-into-separate-process-groups/53823/2 "2025-10-22T13:55:48Z")

</div>

Hi,

I would try [Declarative process grouping](https://docs.dynatrace.com/docs/shortlink/declarative-grouping). Keep in mind process must be restarted to apply changes.

Best regards

---

<div class="post-metadata">

**Author:** ![deni](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/deni/32/163_2.png) [@deni](https://community.dynatrace.com/u/deni)\
**Post date:** [October 22, 2025, 3:06pm UTC](https://community.dynatrace.com/t/how-to-split-java-processes-with-the-same-jar-name-but-different-command-line-arguments-into-separate-process-groups/53823/3 "2025-10-22T15:06:28Z")

</div>

[@AntonPineiro](https://community.dynatrace.com/user/58682)

**Thanks!**

I’m trying to configure it with [Declarative process grouping](https://docs.dynatrace.com/docs/shortlink/declarative-grouping?_gl=1*1sq79zt*_gcl_aw*R0NMLjE3NTk4MzcyNjYuQ2owS0NRanc2NGpEQmhEWEFSSXNBQmtrOEo2MEp2WWFmWXVKTDYyNHZ5ampscjRneWhabXRDTldCQjNBTzNMSWxDeno3WUpmX2JoZnAzUWFBbGtZRUFMd193Y0I.*_ga*ODk0ODg4OTY3LjE3NjA0NTEyNDA.*_ga_1MEMV02JXV*czE3NjExNDQ0NzUkbzMwJGcxJHQxNzYxMTQ0NjI4JGo4JGwwJGgw), but don’t see a way to extract the desired **PG name** &nbsp;from the command line arguments similar to the **Delimiter from** and **Delimiter to** &nbsp;in the **Advanced Detection Rule** or regexp in the&nbsp; **Process Group Naming Rule**.

Can you help me with that?

Regards, Deni

---

<div class="post-metadata">

**Author:** ![Julius\_Loman](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/julius_loman/32/51_2.png) [@Julius\_Loman](https://community.dynatrace.com/u/Julius_Loman)\
**Post date:** [October 22, 2025, 7:27pm UTC](https://community.dynatrace.com/t/how-to-split-java-processes-with-the-same-jar-name-but-different-command-line-arguments-into-separate-process-groups/53823/4 "2025-10-22T19:27:56Z")

</div>

[@deni](https://community.dynatrace.com/user/90225)&nbsp;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 -&nbsp;[Process group detection — Dynatrace Docs](https://docs.dynatrace.com/docs/observe/infrastructure-monitoring/process-groups/configuration/pg-detection)

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.

---

<div class="post-metadata">

**Author:** ![deni](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/deni/32/163_2.png) [@deni](https://community.dynatrace.com/u/deni)\
**Post date:** [October 23, 2025, 6:39am UTC](https://community.dynatrace.com/t/how-to-split-java-processes-with-the-same-jar-name-but-different-command-line-arguments-into-separate-process-groups/53823/5 "2025-10-23T06:39:16Z")

</div>

[@Julius\_Loman](https://community.dynatrace.com/user/3364)

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?

---

<div class="post-metadata">

**Author:** ![deni](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/deni/32/163_2.png) [@deni](https://community.dynatrace.com/u/deni)\
**Post date:** [October 29, 2025, 5:15pm UTC](https://community.dynatrace.com/t/how-to-split-java-processes-with-the-same-jar-name-but-different-command-line-arguments-into-separate-process-groups/53823/6 "2025-10-29T17:15:59Z")

</div>

I finally have a resolution for my case — big thanks to [@MiguelKlosinski](https://community.dynatrace.com/user/60421)&nbsp;from Dynatrace Support! 🙂

Here is the summary:

1.&nbsp; **Process Group Naming Rule** -&nbsp;This rule runs _ **after** _ process groups (PGs) are created. It can be used to **rename existing PGs only**. It **cannot** be used to split process instances (PIs) into different PGs.

2.&nbsp; **Advanced Detection Rule** -&nbsp;My initial mistake was leaving **“Ignore numbers”** enabled while my pattern included digits. After disabling it, PG detection worked as expected.  
Next, we configured **Process instance extraction** so each PI has a unique name. This is a very important step - otherwise every PI goes into its own group, even if the extracted names are identical! We used an unique CMD parameter (the port) to differentiate instances.

Result now looks like this:

PG:&nbsp;&nbsp;my\_jar-test-123  
PI-1:&nbsp;my\_jar-test-123 (1234)  
PI-2: my\_jar-test-123 (1235)

…

Hope this helps anyone facing a similar issue! 🚀
