Skip to main content

Process Naming Rules

UniAgent assigns process names for display in the dashboard.

Note: When Kubernetes starts Docker, the process in Docker must be started in self-start mode to be named correctly. Self-start means the application process inside the Docker container starts together with the Docker container.

Java Process Automatic Naming Rules

  • Default naming for JARs (priority order):

    1. Start-Class in MANIFEST.MF of the JAR package
    2. Main-Class in MANIFEST.MF of the JAR package
    3. The file name of the JAR package (excluding ".jar")

    start_class

  • Default naming for Tomcat (priority order):

    1. If there are WAR packages or extracted WAR directories under the webapps directory and web.xml contains web-display-name, take the first three web-display-names from web.xml, joined by "_".
    2. If there are WAR files under the webapps directory, take the first three file names (excluding ".war"), joined by "_".
    3. The directory name where Tomcat is located.
  • Default naming for Glassfish (priority order):

    1. If there are WAR packages or extracted WAR directories under the autodeploy directory and web.xml contains web-display-name, take the first three web-display-names from web.xml, joined by "_".
    2. If there are WAR files under the autodeploy directory, take the first three file names (excluding ".war"), joined by "_".
    3. The directory name where Glassfish is located.
  • Default naming for Jetty (priority order):

    1. If there are WAR packages or extracted WAR directories under the webapps directory and web.xml contains web-display-name, take the first three web-display-names from web.xml, joined by "_".
    2. If there are WAR files under the webapps directory, take the first three file names (excluding ".war"), joined by "_".
    3. The directory name where Jetty is located.
  • Default naming for Resin (priority order):

    1. If there are WAR packages or extracted WAR directories under the webapps directory and web.xml contains web-display-name, take the first three web-display-names from web.xml, joined by "_".
    2. If there are WAR files under the webapps directory, take the first three file names (excluding ".war"), joined by "_".
    3. The directory name where Resin is located.
  • Default naming for WebLogic: Runtime[domainName] Cmdline[Weblogic.Name]

  • Default naming for Websphere: If there are EAR files under the applications directory, take the first three file names (excluding ".ear"), joined by "_".

  • Default naming for WildFly (priority order):

    1. If there are WAR packages or extracted WAR directories under the deployments directory and web.xml contains web-display-name, take the first three web-display-names from web.xml, joined by "_".
    2. If there are WAR files under the deployments directory, take the first three file names (excluding ".war"), joined by "_".
    3. The directory name where WildFly is located.

.NET Core Process Automatic Naming Rules

The process name is the file name of the startup script .dll.

C/C++ SDK Process Automatic Naming Rules

The process name is the hash value of the executable file name and path.

Custom Process Names

If the automatic naming method does not meet your requirements, you can customize process naming rules via the naming.yml configuration file. Match fields in the naming log, and finally change the process name to the desired format. Process names support Chinese, English, spaces, and special characters, with a maximum length of 128 bytes.

Custom Naming Rule Configuration Instructions

The fields in naming.yml are explained as follows:

NamingRuleGroups:              # Root node, set of naming rule groups, multiple groups can be configured
- NAMING_RULE_GROUP
...

NAMING_RULE_GROUP: # Naming rule group
Container: CONTAINER_NAME # (Required) Name of the container, the text in parentheses in the log is the container name
NamingRules: # Set of naming rules, matched rules participate in naming
- NAMING_RULE
NamingJoin: NAMING_JOIN # When multiple values are obtained, the connector between values. Default is "".

NAMING_RULE: # Naming rule
From: DATA_DIMENSION # (Required) Data dimension. Current dimensions: Cmdline, Local, Env, FileInfo. Each dimension is a Map in the log. For FileInfo, it is an array; configure as FileInfo to traverse the array for the key.
Match: # Match
Key: MATCH_KEY # (Required) Key to match in the specified data dimension
MatchType: MATCH_TYPE # (Required) Match type: contains, equals, regex. If just checking for existence, use contains.
MatchValue: MATCH_VALUE# (Required) Value to match. If just checking for existence, set as empty string.
Naming: # Naming
Key: NAMING_KEY # (Optional) Key in the naming dimension. If specifying a naming value directly, set NAMING_KEY as empty or remove the node.
Default: NAMING_DEFAULT# (Optional) Default value if the key does not exist.
MaxValueCount: NAMING_MAX# (Optional) Number of values to take; default is unlimited. When multiple values are present, limit to the first few.
Replace: # Replace
"/opt/software/": ""
...

Custom Naming Configuration Steps

Example:

  1. Use /opt/tingyun-oneagent/lib/agenthelper to get the naming log. You must specify the process ID:
    /opt/tingyun-oneagent/lib/agenthelper --naming --show-log <PID>
  2. Use the information in Provider Data in the naming log to name the process. The last segment of the log is as follows:
    2021-03-30 14:46:16.016[INFO] [21029] Provider(Tomcat) Data: 
    Cmdline={"catalina.base":"/opt/software/apache-tomcat-8.0.24-8080","catalina.home":"/opt/software/apache-tomcat-8.0.24-8080","classpath":"","java.endorsed.dirs":"/opt/software/apache-tomcat-8.0.24-8080/endorsed","java.io.tmpdir":"/opt/software/apache-tomcat-8.0.24-8080/temp","mainClass":"org.apache.catalina.startup.Bootstrap", ...}
    Local={"containerName":"Tomcat","cwd":"/opt/software/apache-tomcat-8.0.24-8080","exe":"/opt/jdk1.8.0_261/bin/java","httpPort":"8080","lastPathName":"apache-tomcat-8.0.24-8080","name":"java"}
    Env={"CATALINA_OPTS":"-javaagent:/home/xxx/Tingyun/docker_shared/tingyun/tingyun-agent-java.jar","CINNAMON_VERSION":"4.8.6","CLASSPATH":"/opt/software/apache-tomcat-8.0.24-8080/bin/bootstrap.jar:/opt/software/apache-tomcat-8.0.24-8080/bin/tomcat-juli.jar","CLUTTER_IM_MODULE":"fcitx", ...}
    FileInfo[0]={"fileName":"browser_java_test","isDir":"true","web-display-name":"Archetype Created Web Application"}
    FileInfo[1]={"Build-Jdk":"1.8.0_261","Built-By":"xxx","Created-By":"IntelliJ IDEA","Manifest-Version":"1.0","fileName":"browser_java_test.war","isDir":"false","web-display-name":"Archetype Created Web Application"}
    {"Status":"success","Result":"[{\"Flag\":\"Tomcat\",\"Name\":\"browser_java_test\",\"Pid\":21029,\"PodName\":\"\"}]"}
  3. Next, configure the process naming rules in naming.yml. Configuration file path: /opt/tingyun-oneagent/conf/naming.yml Example configuration:
    NamingRuleGroups:
    - Container: Tomcat
    NamingRules:
    - From: Cmdline
    Match:
    Key: catalina.base
    MatchType: contains
    MatchValue: apache-tomcat-8.0.24-8080
    Naming:
    Key: catalina.base
    Replace:
    "/opt/software/apache-tomcat-8.0.24-8080": "Tingyun_Test"
    After matching, the process name will become Tingyun_Test.

Notes

  • When running agenthelper, use the same user as the process.
  • After modifying naming.yml, the refresh time is about 1 minute.
  • After modifying naming.yml, restart the application process after about 2 minutes; the application name will be displayed as defined in the yml.
  • naming.yml uses YAML format. Indentation is two spaces per level. Strictly follow YAML rules, otherwise the file may fail to load.