@@ -101,7 +101,9 @@ private enum AgentFeature {
101101 USM (propertyNameToSystemPropertyName (UsmConfig .USM_ENABLED ), false ),
102102 TELEMETRY (propertyNameToSystemPropertyName (GeneralConfig .TELEMETRY_ENABLED ), true ),
103103 DEBUGGER (propertyNameToSystemPropertyName (DebuggerConfig .DEBUGGER_ENABLED ), false ),
104- DATA_JOBS (propertyNameToSystemPropertyName (GeneralConfig .DATA_JOBS_ENABLED ), false );
104+ DATA_JOBS (propertyNameToSystemPropertyName (GeneralConfig .DATA_JOBS_ENABLED ), false ),
105+ AGENTLESS_LOG_SUBMISSION (
106+ propertyNameToSystemPropertyName (GeneralConfig .AGENTLESS_LOG_SUBMISSION_ENABLED ), false );
105107
106108 private final String systemProp ;
107109 private final boolean enabledByDefault ;
@@ -145,6 +147,7 @@ public boolean isEnabledByDefault() {
145147 private static boolean usmEnabled = false ;
146148 private static boolean telemetryEnabled = true ;
147149 private static boolean debuggerEnabled = false ;
150+ private static boolean agentlessLogSubmissionEnabled = false ;
148151
149152 public static void start (final Instrumentation inst , final URL agentJarURL , String agentArgs ) {
150153 StaticEventLogger .begin ("Agent" );
@@ -231,6 +234,7 @@ public static void start(final Instrumentation inst, final URL agentJarURL, Stri
231234 cwsEnabled = isFeatureEnabled (AgentFeature .CWS );
232235 telemetryEnabled = isFeatureEnabled (AgentFeature .TELEMETRY );
233236 debuggerEnabled = isFeatureEnabled (AgentFeature .DEBUGGER );
237+ agentlessLogSubmissionEnabled = isFeatureEnabled (AgentFeature .AGENTLESS_LOG_SUBMISSION );
234238
235239 if (profilingEnabled ) {
236240 if (!isOracleJDK8 ()) {
@@ -362,7 +366,9 @@ public static void shutdown(final boolean sync) {
362366 if (telemetryEnabled ) {
363367 stopTelemetry ();
364368 }
365- shutdownLogsIntake ();
369+ if (agentlessLogSubmissionEnabled ) {
370+ shutdownLogsIntake ();
371+ }
366372 }
367373
368374 public static synchronized Class <?> installAgentCLI () throws Exception {
@@ -801,18 +807,20 @@ private static void maybeStartCiVisibility(Instrumentation inst, Class<?> scoCla
801807 }
802808
803809 private static void maybeStartLogsIntake (Class <?> scoClass , Object sco ) {
804- StaticEventLogger .begin ("Logs Intake" );
810+ if (agentlessLogSubmissionEnabled ) {
811+ StaticEventLogger .begin ("Logs Intake" );
805812
806- try {
807- final Class <?> logsIntakeSystemClass =
808- AGENT_CLASSLOADER .loadClass ("datadog.trace.logging.intake.LogsIntakeSystem" );
809- final Method logsIntakeInstallerMethod = logsIntakeSystemClass .getMethod ("start" , scoClass );
810- logsIntakeInstallerMethod .invoke (null , sco );
811- } catch (final Throwable e ) {
812- log .warn ("Not starting Logs Intake subsystem" , e );
813- }
813+ try {
814+ final Class <?> logsIntakeSystemClass =
815+ AGENT_CLASSLOADER .loadClass ("datadog.trace.logging.intake.LogsIntakeSystem" );
816+ final Method logsIntakeInstallerMethod = logsIntakeSystemClass .getMethod ("start" , scoClass );
817+ logsIntakeInstallerMethod .invoke (null , sco );
818+ } catch (final Throwable e ) {
819+ log .warn ("Not starting Logs Intake subsystem" , e );
820+ }
814821
815- StaticEventLogger .end ("Logs Intake" );
822+ StaticEventLogger .end ("Logs Intake" );
823+ }
816824 }
817825
818826 private static void shutdownLogsIntake () {
0 commit comments