Regex not working in regex.custom.pm

Post Reply
ffeingol
Junior Member
Posts: 32
Joined: 07 Aug 2007, 23:13

Regex not working in regex.custom.pm

Post by ffeingol »

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;

Code: Select all

40.##.##.## - - [20/Apr/2025:08:39:37 -0500] "GET /wp-admin/css/colors/Admin-Author.php HTTP/1.1" 500 17551 "-" "-"
The code we put in regex.custom.pm is like this:

Code: Select all

if (($globlogs{CUSTOM2_LOG}{$lgfile}) and ($line =~ / "-" "-"$/)) {
    return ("No User Agent",$1,"UserAgent","20","80,443","3600");
    }
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.
Post Reply