diff options
8 files changed, 29 insertions, 5 deletions
diff --git a/application/src/main/java/com/yahoo/application/Application.java b/application/src/main/java/com/yahoo/application/Application.java index d4b1735e4c1..a2c6e84ecb7 100644 --- a/application/src/main/java/com/yahoo/application/Application.java +++ b/application/src/main/java/com/yahoo/application/Application.java @@ -124,6 +124,7 @@ public final class Application implements AutoCloseable { .applicationPackage(FilesApplicationPackage.fromFile(path.toFile(), true)) .modelImporters(modelImporters) .deployLogger((level, s) -> { }) + .accessLoggingEnabledByDefault(false) .build(); return new VespaModel(new NullConfigModelRegistry(), deployState); } catch (IOException | SAXException e) { diff --git a/athenz-identity-provider-service/src/test/java/com/yahoo/vespa/hosted/ca/restapi/ContainerTester.java b/athenz-identity-provider-service/src/test/java/com/yahoo/vespa/hosted/ca/restapi/ContainerTester.java index 0eda6bd946b..6783763b210 100644 --- a/athenz-identity-provider-service/src/test/java/com/yahoo/vespa/hosted/ca/restapi/ContainerTester.java +++ b/athenz-identity-provider-service/src/test/java/com/yahoo/vespa/hosted/ca/restapi/ContainerTester.java @@ -54,6 +54,7 @@ public class ContainerTester { private static String servicesXml() { return "<container version='1.0'>\n" + + " <accesslog type=\"disabled\"/>\n" + " <config name=\"container.handler.threadpool\">\n" + " <maxthreads>10</maxthreads>\n" + " </config>\n" + diff --git a/config-model/src/main/java/com/yahoo/config/model/deploy/DeployState.java b/config-model/src/main/java/com/yahoo/config/model/deploy/DeployState.java index 7c9e930bb4f..a9b4e06ae1b 100644 --- a/config-model/src/main/java/com/yahoo/config/model/deploy/DeployState.java +++ b/config-model/src/main/java/com/yahoo/config/model/deploy/DeployState.java @@ -67,6 +67,7 @@ public class DeployState implements ConfigDefinitionStore { private final Optional<ConfigDefinitionRepo> configDefinitionRepo; private final Optional<ApplicationPackage> permanentApplicationPackage; private final Optional<Model> previousModel; + private final boolean accessLoggingEnabledByDefault; private final ModelContext.Properties properties; private final Version vespaVersion; private final Set<ContainerEndpoint> endpoints; @@ -101,14 +102,15 @@ public class DeployState implements ConfigDefinitionStore { Version vespaVersion, Optional<ApplicationPackage> permanentApplicationPackage, Optional<ConfigDefinitionRepo> configDefinitionRepo, - java.util.Optional<Model> previousModel, + Optional<Model> previousModel, Set<ContainerEndpoint> endpoints, Collection<MlModelImporter> modelImporters, Zone zone, QueryProfiles queryProfiles, SemanticRules semanticRules, Instant now, - Version wantedNodeVespaVersion) { + Version wantedNodeVespaVersion, + boolean accessLoggingEnabledByDefault) { this.logger = deployLogger; this.fileRegistry = fileRegistry; this.rankProfileRegistry = rankProfileRegistry; @@ -116,6 +118,7 @@ public class DeployState implements ConfigDefinitionStore { this.properties = properties; this.vespaVersion = vespaVersion; this.previousModel = previousModel; + this.accessLoggingEnabledByDefault = accessLoggingEnabledByDefault; this.provisioner = hostProvisioner.orElse(getDefaultModelHostProvisioner(applicationPackage)); this.searchDefinitions = searchDocumentModel.getSearchDefinitions(); this.documentModel = searchDocumentModel.getDocumentModel(); @@ -217,6 +220,10 @@ public class DeployState implements ConfigDefinitionStore { return logger; } + public boolean getAccessLoggingEnabledByDefault() { + return accessLoggingEnabledByDefault; + } + public FileRegistry getFileRegistry() { return fileRegistry; } @@ -289,6 +296,7 @@ public class DeployState implements ConfigDefinitionStore { private Zone zone = Zone.defaultZone(); private Instant now = Instant.now(); private Version wantedNodeVespaVersion = Vtag.currentVersion; + private boolean accessLoggingEnabledByDefault = true; public Builder applicationPackage(ApplicationPackage applicationPackage) { this.applicationPackage = applicationPackage; @@ -360,6 +368,15 @@ public class DeployState implements ConfigDefinitionStore { return this; } + /** + * Whether access logging is enabled for an application without an accesslog element in services.xml. + * True by default. + */ + public Builder accessLoggingEnabledByDefault(boolean accessLoggingEnabledByDefault) { + this.accessLoggingEnabledByDefault = accessLoggingEnabledByDefault; + return this; + } + public DeployState build() { return build(new ValidationParameters()); } @@ -386,7 +403,8 @@ public class DeployState implements ConfigDefinitionStore { queryProfiles, semanticRules, now, - wantedNodeVespaVersion); + wantedNodeVespaVersion, + accessLoggingEnabledByDefault); } private SearchDocumentModel createSearchDocumentModel(RankProfileRegistry rankProfileRegistry, 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 d09f23da64e..9d7274f1bbf 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 @@ -302,7 +302,7 @@ public class ContainerModelBuilder extends ConfigModelBuilder<ContainerModel> { AccessLogBuilder.buildIfNotDisabled(deployState, cluster, accessLog).ifPresent(cluster::addComponent); } - if (accessLogElements.isEmpty()) + if (accessLogElements.isEmpty() && deployState.getAccessLoggingEnabledByDefault()) cluster.addDefaultSearchAccessLog(); } diff --git a/container-integration-test/src/test/java/com/yahoo/search/query/gui/GUIHandlerTest.java b/container-integration-test/src/test/java/com/yahoo/search/query/gui/GUIHandlerTest.java index 00272778a2b..7ca5d2a6b10 100644 --- a/container-integration-test/src/test/java/com/yahoo/search/query/gui/GUIHandlerTest.java +++ b/container-integration-test/src/test/java/com/yahoo/search/query/gui/GUIHandlerTest.java @@ -72,6 +72,7 @@ public class GUIHandlerTest { private String servicesXml() { return "<container version='1.0'>\n" + + " <accesslog type='disabled'/>\n" + " <handler id='com.yahoo.search.query.gui.GUIHandler'>\n" + " <binding>http://*/querybuilder/*</binding>\n" + " </handler>\n" + diff --git a/orchestrator/src/test/java/com/yahoo/vespa/orchestrator/resources/ApplicationSuspensionResourceTest.java b/orchestrator/src/test/java/com/yahoo/vespa/orchestrator/resources/ApplicationSuspensionResourceTest.java index 2996220561c..80d0af09792 100644 --- a/orchestrator/src/test/java/com/yahoo/vespa/orchestrator/resources/ApplicationSuspensionResourceTest.java +++ b/orchestrator/src/test/java/com/yahoo/vespa/orchestrator/resources/ApplicationSuspensionResourceTest.java @@ -155,6 +155,7 @@ public class ApplicationSuspensionResourceTest { return "<services>\n" + " <container version=\"1.0\" jetty=\"true\">\n" + + " <accesslog type=\"disabled\"/>\n" + " <config name=\"container.handler.threadpool\">\n" + " <maxthreads>10</maxthreads>\n" + " </config>\n" + diff --git a/vespaclient-container-plugin/src/test/java/com/yahoo/document/restapi/resource/RestApiTest.java b/vespaclient-container-plugin/src/test/java/com/yahoo/document/restapi/resource/RestApiTest.java index aeddc762586..0661363477f 100644 --- a/vespaclient-container-plugin/src/test/java/com/yahoo/document/restapi/resource/RestApiTest.java +++ b/vespaclient-container-plugin/src/test/java/com/yahoo/document/restapi/resource/RestApiTest.java @@ -202,7 +202,7 @@ public class RestApiTest { // Get logs through some hackish fetch method. Logs is something the mocked backend write. String getLog() throws IOException { - // The mocked backend will throw a runtime exception wtih a log if delete is called three times.. + // The mocked backend will throw a runtime exception with a log if delete is called three times.. Request request = new Request("http://localhost:" + getFirstListenPort() + remove_test_uri); HttpDelete delete = new HttpDelete(request.getUri()); doRest(delete); diff --git a/vespaclient-container-plugin/src/test/rest-api-application/services.xml b/vespaclient-container-plugin/src/test/rest-api-application/services.xml index 346740bc815..ae1b87635a9 100644 --- a/vespaclient-container-plugin/src/test/rest-api-application/services.xml +++ b/vespaclient-container-plugin/src/test/rest-api-application/services.xml @@ -2,6 +2,8 @@ <!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. --> <container version="1.0" jetty="true"> + <accesslog type="disabled"/> + <handler id="com.yahoo.document.restapi.resource.RestApiWithTestDocumentHandler" bundle="integration-test"> <binding>http://*/document/v1/*</binding> </handler> |