Regex not working in regex.custom.pm
Posted: 22 Apr 2025, 13:01
We are trying to block access to a web server when there is no user agent and not referrer. Example log lines look like this;
The code we put in regex.custom.pm is like this:
CUSTOM2_LOG is set properly and works for other regex's we have in regex.custom.pm
Any thoughts/suggestions as to why it's not working properly would be greatly appreciated.
Code: Select all
40.##.##.## - - [20/Apr/2025:08:39:37 -0500] "GET /wp-admin/css/colors/Admin-Author.php HTTP/1.1" 500 17551 "-" "-"
Code: Select all
if (($globlogs{CUSTOM2_LOG}{$lgfile}) and ($line =~ / "-" "-"$/)) {
return ("No User Agent",$1,"UserAgent","20","80,443","3600");
}
Any thoughts/suggestions as to why it's not working properly would be greatly appreciated.