in apm-agent-attach-cli/src/main/java/co/elastic/apm/attach/AgentAttacher.java [530:610]
static void printHelp(PrintStream out) {
out.println("SYNOPSIS");
out.println(" java -jar apm-agent-attach-cli.jar [--include-* <pattern>...] [--exclude-* <pattern>...]");
out.println(" [--continuous]");
out.println(" [--config <key=value>... | --args-provider <args_provider_script>]");
out.println(" [--list] [--list-vmargs]");
out.println(" [--log-level <level>]");
out.println(" java -jar apm-agent-attach-cli.jar --help");
out.println();
out.println("DESCRIPTION");
out.println(" Attaches the Elastic APM Java agent to all running JVMs that match the `--include-*` / `--exclude-*` discovery rules.");
out.println(" For every running JVM, the discovery rules are evaluated in the order they are provided.");
out.println(" The first matching rule determines the outcome.");
out.println(" * If the first matching rules is an exclude, the agent will not be attached.");
out.println(" * If the first matching rules is an include, the agent will be attached.");
out.println(" * If no rule matches, the agent will not be attached.");
out.println();
out.println("OPTIONS");
out.println(" -l, --list");
out.println(" This lets you do a dry run of the include/exclude discovery rules.");
out.println(" Instead of attaching to matching JVMs, the programm will print JVMs that match the include/exclude discovery rules.");
out.println(" Similar to `jps -l`, the output includes the PID and the main class name or the path to the jar file.");
out.println();
out.println(" -v, --list-vmargs");
out.println(" When listing running JVMs via `--list`, include the arguments passed to the JVM.");
out.println(" Provides an output similar to `jps -lv`.");
out.println(" Note: The JVM arguments may contain sensitive information, such as passwords provided via system properties.");
out.println();
out.println(" -c, --continuous");
out.println(" If provided, this program continuously runs and attaches to all running and starting JVMs which match the --exclude and --include filters.");
out.println();
out.println(" --no-fork");
out.println(" By default, when the attacher program is ran by user A and the target process is ran by user B, ");
out.println(" the attacher will attempt to start another process as user B. ");
out.println(" If this configuration option is provided, the attacher will not fork. Instead, it will attempt to attach directly as the current user.");
out.println();
out.println(" --include-all");
out.println(" Includes all JVMs for attachment.");
out.println();
out.println(" --include-pid <pid>...");
out.println(" A list of PIDs to include.");
out.println();
out.println(" --include-main/--exclude-main <pattern>");
out.println(" A regular expression of fully qualified main class names or paths to JARs of applications the java agent should be attached to.");
out.println(" Performs a partial match so that `foo` matches `/bin/foo.jar`.");
out.println();
out.println(" --include-vmarg/--exclude-vmarg <pattern>");
out.println(" A regular expression that is matched against the arguments passed to the JVM, such as system properties.");
out.println(" Performs a partial match so that `attach=true` matches the system property `-Dattach=true`.");
out.println();
out.println(" --include-user/--exclude-user <user>");
out.println(" A username that is matched against the operating system user that run the JVM.");
out.println(" For included users, make sure that the user this program is running under is either the same user or has permissions to switch to the user that runs the target JVM.");
out.println();
out.println(" -C --config <key=value>...");
out.println(" This repeatable option sets one agent configuration option.");
out.println(" Example: --config server_url=http://127.0.0.1:8200.");
out.println();
out.println(" -A, --args-provider <args_provider_script>");
out.println(" The name of a program which is called when a new JVM starts up.");
out.println(" The program gets the pid as an argument");
out.println(" and returns an arg string which is used to configure the agent on the attached JVM (agentArguments of agentmain).");
out.println(" When returning a non-zero status code from this program, the agent will not be attached to the starting JVM.");
out.println(" The syntax of the arguments is 'key1=value1;key2=value1,value2'.");
out.println(" Note: this option can not be used in conjunction with --include-pid and --args.");
out.println();
out.println(" -g, --log-level <off|fatal|error|warn|info|debug|trace|all>");
out.println(" Configures the verbosity of the logs that are sent to stdout with an ECS JSON format.");
out.println();
out.println(" --log-file <file>");
out.println(" To log into a file instead of the console, specify a path to a file that this program should log into.");
out.println(" The log file rolls over once the file has reached a size of 10MB.");
out.println(" One history file will be kept with the name `${logFile}.1`.");
out.println();
out.println(" --agent-jar <file>");
out.println(" Instead of the bundled agent jar, attach the provided agent to the target JVMs.");
out.println();
out.println(" --download-agent-version <agent-version>");
out.println(" Instead of the bundled agent jar, download and attach the specified agent version from maven.");
out.println(" <agent-version> can be either the explicit version (for example: `1.15.0`) or `latest`.");
}