|
@@ -45,12 +45,6 @@ class APMJvmOptions {
|
|
|
// Identifies the version of Elasticsearch in the captured trace data.
|
|
|
"service_version", Build.current().version(),
|
|
|
|
|
|
- // Configures a log file to write to. `_AGENT_HOME_` is a placeholder used
|
|
|
- // by the agent. Don't disable writing to a log file, as the agent will then
|
|
|
- // require extra Security Manager permissions when it tries to do something
|
|
|
- // else, and it's just painful.
|
|
|
- "log_file", "_AGENT_HOME_/../../logs/apm.log",
|
|
|
-
|
|
|
// ES does not use auto-instrumentation.
|
|
|
"instrument", "false",
|
|
|
"enable_experimental_instrumentations", "true"
|
|
@@ -80,7 +74,8 @@ class APMJvmOptions {
|
|
|
|
|
|
// Logging configuration. Unless you need detailed logs about what the APM
|
|
|
// is doing, leave this value alone.
|
|
|
- "log_level", "error",
|
|
|
+ "log_level", "warn",
|
|
|
+ "log_format_file", "JSON",
|
|
|
"application_packages", "org.elasticsearch,org.apache.lucene",
|
|
|
"metrics_interval", "120s",
|
|
|
"breakdown_metrics", "false",
|
|
@@ -134,9 +129,11 @@ class APMJvmOptions {
|
|
|
*
|
|
|
* @param settings the Elasticsearch settings to consider
|
|
|
* @param secrets a wrapper to access the secrets, or null if there is no secrets
|
|
|
+ * @param logsDir the directory to write the apm log into
|
|
|
* @param tmpdir Elasticsearch's temporary directory, where the config file will be written
|
|
|
*/
|
|
|
- static List<String> apmJvmOptions(Settings settings, @Nullable SecureSettings secrets, Path tmpdir) throws UserException, IOException {
|
|
|
+ static List<String> apmJvmOptions(Settings settings, @Nullable SecureSettings secrets, Path logsDir, Path tmpdir) throws UserException,
|
|
|
+ IOException {
|
|
|
final Path agentJar = findAgentJar();
|
|
|
|
|
|
if (agentJar == null) {
|
|
@@ -145,6 +142,11 @@ class APMJvmOptions {
|
|
|
|
|
|
final Map<String, String> propertiesMap = extractApmSettings(settings);
|
|
|
|
|
|
+ // Configures a log file to write to. Don't disable writing to a log file,
|
|
|
+ // as the agent will then require extra Security Manager permissions when
|
|
|
+ // it tries to do something else, and it's just painful.
|
|
|
+ propertiesMap.put("log_file", logsDir.resolve("apm-agent.log").toString());
|
|
|
+
|
|
|
// No point doing anything if we don't have a destination for the trace data, and it can't be configured dynamically
|
|
|
if (propertiesMap.containsKey("server_url") == false && propertiesMap.containsKey("server_urls") == false) {
|
|
|
return List.of();
|