Improved bot log detection.

This commit is contained in:
Christian P. MOMON 2021-05-25 12:39:59 +02:00
parent 330e81c02b
commit 078a6909a5

View file

@ -23,6 +23,7 @@ import java.time.format.DateTimeFormatter;
import java.util.Locale; import java.util.Locale;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -184,7 +185,18 @@ public class HttpAccessLog
{ {
boolean result; boolean result;
result = StringsUtils.containsAnyIgnoreCase(this.userAgent.toString(), "bot", "monitoring"); if (StringsUtils.containsAnyIgnoreCase(this.userAgent.toString(), "bot", "monitoring", "Apache-HttpClient"))
{
result = true;
}
else if (StringUtils.startsWithAny(this.userAgent.toString(), "Java/", "HotJava/"))
{
result = true;
}
else
{
result = false;
}
// //
return result; return result;