summaryrefslogtreecommitdiffstats
path: root/config-model/src/main
diff options
context:
space:
mode:
authorMorten Tokle <mortent@verizonmedia.com>2021-01-19 08:40:15 +0100
committerMorten Tokle <mortent@verizonmedia.com>2021-01-19 10:09:27 +0100
commit274078dd8e9f90bbe86ef07a89acfc2437e22cec (patch)
treed2ca31530bb9d791a928a54c992d700785ca36bf /config-model/src/main
parent5ce314d5989ce4753004d8e13faafb905217bc8b (diff)
Write connection log to file
Diffstat (limited to 'config-model/src/main')
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/container/component/ConnectionLogComponent.java22
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/container/xml/ContainerModelBuilder.java7
2 files changed, 26 insertions, 3 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/container/component/ConnectionLogComponent.java b/config-model/src/main/java/com/yahoo/vespa/model/container/component/ConnectionLogComponent.java
new file mode 100644
index 00000000000..f3f83a30f15
--- /dev/null
+++ b/config-model/src/main/java/com/yahoo/vespa/model/container/component/ConnectionLogComponent.java
@@ -0,0 +1,22 @@
+// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+
+package com.yahoo.vespa.model.container.component;
+
+import com.yahoo.container.logging.ConnectionLog;
+import com.yahoo.jdisc.http.container.logging.ConnectionLogConfig;
+import com.yahoo.osgi.provider.model.ComponentModel;
+
+public class ConnectionLogComponent extends SimpleComponent implements ConnectionLogConfig.Producer {
+
+ private final String clusterName;
+
+ public ConnectionLogComponent(Class<? extends ConnectionLog> cls, String clusterName) {
+ super(new ComponentModel(cls.getName(), null, "jdisc_http_service", null));
+ this.clusterName = clusterName;
+ }
+
+ @Override
+ public void getConfig(ConnectionLogConfig.Builder builder) {
+ builder.cluster(clusterName);
+ }
+}
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/container/xml/ContainerModelBuilder.java b/config-model/src/main/java/com/yahoo/vespa/model/container/xml/ContainerModelBuilder.java
index dc7b03b0064..15a37813150 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/container/xml/ContainerModelBuilder.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/container/xml/ContainerModelBuilder.java
@@ -31,7 +31,7 @@ import com.yahoo.config.provision.HostName;
import com.yahoo.config.provision.NodeResources;
import com.yahoo.config.provision.NodeType;
import com.yahoo.config.provision.Zone;
-import com.yahoo.container.logging.SimpleConnectionLog;
+import com.yahoo.container.logging.FileConnectionLog;
import com.yahoo.jdisc.http.server.jetty.VoidConnectionLog;
import com.yahoo.osgi.provider.model.ComponentModel;
import com.yahoo.search.rendering.RendererRegistry;
@@ -63,6 +63,7 @@ import com.yahoo.vespa.model.container.IdentityProvider;
import com.yahoo.vespa.model.container.SecretStore;
import com.yahoo.vespa.model.container.component.AccessLogComponent;
import com.yahoo.vespa.model.container.component.BindingPattern;
+import com.yahoo.vespa.model.container.component.ConnectionLogComponent;
import com.yahoo.vespa.model.container.component.FileStatusHandlerComponent;
import com.yahoo.vespa.model.container.component.Handler;
import com.yahoo.vespa.model.container.component.SimpleComponent;
@@ -349,9 +350,9 @@ public class ContainerModelBuilder extends ConfigModelBuilder<ContainerModel> {
// Add connection log if access log is configured
if (cluster.getAllComponents().stream().anyMatch(component -> component instanceof AccessLogComponent)) {
- cluster.addSimpleComponent(SimpleConnectionLog.class.getName(), null, "jdisc_http_service");
+ cluster.addComponent(new ConnectionLogComponent(FileConnectionLog.class, cluster.getName()));
} else {
- cluster.addSimpleComponent(VoidConnectionLog.class.getName(), null, "jdisc_http_service");
+ cluster.addComponent(new ConnectionLogComponent(VoidConnectionLog.class, cluster.getName()));
}
}