This is an automated email from the ASF dual-hosted git repository.
dockerzhang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/inlong.git
The following commit(s) were added to refs/heads/master by this push:
new 8942f35c03 [INLONG-11499][Agent] By default, use the locally
configured audit address (#11500)
8942f35c03 is described below
commit 8942f35c03896b0f37cdd3dd2f9bdbfc5a56dd31
Author: justinwwhuang <[email protected]>
AuthorDate: Fri Nov 15 10:59:52 2024 +0800
[INLONG-11499][Agent] By default, use the locally configured audit address
(#11500)
---
.../org/apache/inlong/agent/constant/AgentConstants.java | 1 +
.../org/apache/inlong/agent/metrics/audit/AuditUtils.java | 13 +++++++++++--
inlong-agent/conf/agent.properties | 4 ++++
3 files changed, 16 insertions(+), 2 deletions(-)
diff --git
a/inlong-agent/agent-common/src/main/java/org/apache/inlong/agent/constant/AgentConstants.java
b/inlong-agent/agent-common/src/main/java/org/apache/inlong/agent/constant/AgentConstants.java
index ec5831973b..f7c0f0d7c8 100755
---
a/inlong-agent/agent-common/src/main/java/org/apache/inlong/agent/constant/AgentConstants.java
+++
b/inlong-agent/agent-common/src/main/java/org/apache/inlong/agent/constant/AgentConstants.java
@@ -68,6 +68,7 @@ public class AgentConstants {
public static final String AUDIT_ENABLE = "audit.enable";
public static final boolean DEFAULT_AUDIT_ENABLE = true;
+ public static final String AUDIT_PROXY_ADDRESS = "audit.proxys";
public static final String AGENT_HISTORY_PATH = "agent.history.path";
public static final String DEFAULT_AGENT_HISTORY_PATH = ".history";
diff --git
a/inlong-agent/agent-common/src/main/java/org/apache/inlong/agent/metrics/audit/AuditUtils.java
b/inlong-agent/agent-common/src/main/java/org/apache/inlong/agent/metrics/audit/AuditUtils.java
index fa425d7782..b4f74bfc63 100644
---
a/inlong-agent/agent-common/src/main/java/org/apache/inlong/agent/metrics/audit/AuditUtils.java
+++
b/inlong-agent/agent-common/src/main/java/org/apache/inlong/agent/metrics/audit/AuditUtils.java
@@ -22,7 +22,10 @@ import org.apache.inlong.agent.constant.AgentConstants;
import org.apache.inlong.audit.AuditOperator;
import org.apache.inlong.audit.entity.AuditComponent;
+import java.util.HashSet;
+
import static org.apache.inlong.agent.constant.AgentConstants.AUDIT_ENABLE;
+import static
org.apache.inlong.agent.constant.AgentConstants.AUDIT_PROXY_ADDRESS;
import static
org.apache.inlong.agent.constant.AgentConstants.DEFAULT_AUDIT_ENABLE;
import static
org.apache.inlong.agent.constant.FetcherConstants.AGENT_MANAGER_ADDR;
import static
org.apache.inlong.agent.constant.FetcherConstants.AGENT_MANAGER_AUTH_SECRET_ID;
@@ -67,8 +70,14 @@ public class AuditUtils {
public static void initAudit(AbstractConfiguration conf) {
IS_AUDIT = conf.getBoolean(AUDIT_ENABLE, DEFAULT_AUDIT_ENABLE);
if (IS_AUDIT) {
- AuditOperator.getInstance().setAuditProxy(AuditComponent.AGENT,
conf.get(AGENT_MANAGER_ADDR),
- conf.get(AGENT_MANAGER_AUTH_SECRET_ID),
conf.get(AGENT_MANAGER_AUTH_SECRET_KEY));
+ if (conf.hasKey(AUDIT_PROXY_ADDRESS)) {
+ HashSet<String> address = new HashSet<>();
+ address.add(conf.get(AUDIT_PROXY_ADDRESS));
+ AuditOperator.getInstance().setAuditProxy(address);
+ } else {
+
AuditOperator.getInstance().setAuditProxy(AuditComponent.AGENT,
conf.get(AGENT_MANAGER_ADDR),
+ conf.get(AGENT_MANAGER_AUTH_SECRET_ID),
conf.get(AGENT_MANAGER_AUTH_SECRET_KEY));
+ }
AuditOperator.getInstance().setLocalIP(conf.get(AgentConstants.AGENT_LOCAL_IP));
}
}
diff --git a/inlong-agent/conf/agent.properties
b/inlong-agent/conf/agent.properties
index ec5637eb08..1152005724 100755
--- a/inlong-agent/conf/agent.properties
+++ b/inlong-agent/conf/agent.properties
@@ -98,3 +98,7 @@ agent.prometheus.exporter.port=9080
############################
# whether to enable audit
audit.enable=true
+# Audit proxy address
+# By default, the audit address is obtained from the manager, and only in
special circumstances do
+# special addresses need to be specified through this configuration option
+# audit.proxys=
\ No newline at end of file