Improved bot log detection.
This commit is contained in:
parent
330e81c02b
commit
078a6909a5
1 changed files with 13 additions and 1 deletions
|
@ -23,6 +23,7 @@ import java.time.format.DateTimeFormatter;
|
|||
import java.util.Locale;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -184,7 +185,18 @@ public class HttpAccessLog
|
|||
{
|
||||
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;
|
||||
|
|
Loading…
Reference in a new issue