aboutsummaryrefslogtreecommitdiffstats
path: root/config-model
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@oath.com>2018-03-15 11:34:06 +0100
committerGitHub <noreply@github.com>2018-03-15 11:34:06 +0100
commit0bc38db07a91dd521f69456bcf4c8b04b8c768ed (patch)
tree465f517d7bdf9e30bc9b37016787b10d30420994 /config-model
parent42ed2f6d0954acd25a9cd3fb3367710f77144d42 (diff)
parent236ec279fdbc3f9a412d968d0593268ff3f566e9 (diff)
Merge pull request #5285 from vespa-engine/arnej/add-gzip-accesslogs
hack in gzip of access logs
Diffstat (limited to 'config-model')
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/container/component/AccessLogComponent.java15
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/container/xml/AccessLogBuilder.java6
2 files changed, 18 insertions, 3 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/container/component/AccessLogComponent.java b/config-model/src/main/java/com/yahoo/vespa/model/container/component/AccessLogComponent.java
index dbde510f9e0..7da7abe0546 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/container/component/AccessLogComponent.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/container/component/AccessLogComponent.java
@@ -17,18 +17,18 @@ import static com.yahoo.container.core.AccessLogConfig.FileHandler.RotateScheme;
*/
public final class AccessLogComponent extends SimpleComponent implements AccessLogConfig.Producer {
-
public enum AccessLogType { queryAccessLog, yApacheAccessLog, jsonAccessLog }
private final String fileNamePattern;
private final String rotationInterval;
private final RotateScheme.Enum rotationScheme;
+ private final Boolean compression;
private final String symlinkName;
public AccessLogComponent(AccessLogType logType, String clusterName) {
this(logType,
String.format("logs/vespa/qrs/%s.%s.%s", capitalize(logType.name()), clusterName, "%Y%m%d%H%M%S"),
- null, null,
+ null, null, null,
capitalize(logType.name()) + "." + clusterName);
}
@@ -39,11 +39,15 @@ public final class AccessLogComponent extends SimpleComponent implements AccessL
public AccessLogComponent(AccessLogType logType,
String fileNamePattern,
String rotationInterval,
- RotateScheme.Enum rotationScheme, String symlinkName) {
+ RotateScheme.Enum rotationScheme,
+ Boolean compressOnRotation,
+ String symlinkName)
+ {
super(new ComponentModel(accessLogClass(logType), null, "container-core", null));
this.fileNamePattern = fileNamePattern;
this.rotationInterval = rotationInterval;
this.rotationScheme = rotationScheme;
+ this.compression = compressOnRotation;
this.symlinkName = symlinkName;
if (fileNamePattern == null)
@@ -78,6 +82,11 @@ public final class AccessLogComponent extends SimpleComponent implements AccessL
builder.rotateScheme(rotationScheme);
if (symlinkName != null)
builder.symlink(symlinkName);
+ if (compression != null) {
+ builder.compressOnRotation(compression);
+ } else if (isHostedVespa()) {
+ builder.compressOnRotation(true);
+ }
return builder;
}
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/container/xml/AccessLogBuilder.java b/config-model/src/main/java/com/yahoo/vespa/model/container/xml/AccessLogBuilder.java
index 4d422d921c8..1b15a49462e 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/container/xml/AccessLogBuilder.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/container/xml/AccessLogBuilder.java
@@ -57,6 +57,7 @@ public class AccessLogBuilder {
fileNamePattern(spec),
rotationInterval(spec),
rotationScheme(spec),
+ compressOnRotation(spec),
symlinkName(spec));
}
@@ -64,6 +65,11 @@ public class AccessLogBuilder {
return nullIfEmpty(spec.getAttribute("symlinkName"));
}
+ private Boolean compressOnRotation(Element spec) {
+ String compress = spec.getAttribute("compressOnRotation");
+ return (compress.isEmpty() ? null : Boolean.parseBoolean(compress));
+ }
+
private AccessLogConfig.FileHandler.RotateScheme.Enum rotationScheme(Element spec) {
return AccessLogComponent.rotateScheme(nullIfEmpty(spec.getAttribute("rotationScheme")));
}