diff --git a/src/fr/devinsy/statoolinfos/metrics/http/HttpAccessLog.java b/src/fr/devinsy/statoolinfos/metrics/http/HttpAccessLog.java index 4f9ee9f..1784ea5 100644 --- a/src/fr/devinsy/statoolinfos/metrics/http/HttpAccessLog.java +++ b/src/fr/devinsy/statoolinfos/metrics/http/HttpAccessLog.java @@ -21,6 +21,7 @@ package fr.devinsy.statoolinfos.metrics.http; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.Locale; +import java.util.regex.Pattern; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -35,6 +36,8 @@ public class HttpAccessLog { private static Logger logger = LoggerFactory.getLogger(HttpAccessLog.class); + public static final Pattern ASSET_PATTERN = Pattern.compile("^.*\\.(avi|css|gif|ico|jpeg|jpg|js|mp3|mp4|ogg|png|svg|wav) HTTP.*$"); + private String ip; private String remoteUser; private LocalDateTime time; @@ -240,7 +243,8 @@ public class HttpAccessLog { boolean result; - if ((this.status.getCategory() == HttpStatusCategory.SUCCESS) && (!isBot()) && (this.request.startsWith("GET "))) + if ((this.status.getCategory() == HttpStatusCategory.SUCCESS) && (!isBot()) && (this.request.startsWith("GET ")) && + (!ASSET_PATTERN.matcher(this.request).matches())) { result = true; }