Ad Widget

Collapse

Regex for 500 erros in Apache log fails.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pontus
    Junior Member
    • Sep 2024
    • 3

    #1

    Regex for 500 erros in Apache log fails.

    I've set up Zabbix active agent to monitor Apache logs for 50x error using the following item
    Code:
    logrt[/var/log/apache2/host.domain.com/access.log, 50\d ,,,skip]
    This gives me matches for 50x errors but also for other things containing 500, such as request size.
    The regexp, that do start and ends with space " 50\d " works as intended on regex101.com

    The following line in the log file gets a match by Zabbix but shouldn't
    192.168.1.47 - - [04/Sep/2024:07:09:23 +0200] "GET /some/path/to/some/file.extension HTTP/1.1" 200 4502 "-" "Some browser based on Alamofire/5.9.1"
    Only this should give a match
    192.168.1.47 - - [04/Sep/2024:07:09:23 +0200] "GET /some/path/to/some/file.extension HTTP/1.1" 500 4502 "-" "Some browser based on Alamofire/5.9.1"
    Any advice is highly appreciated.
  • cyber
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Dec 2006
    • 4807

    #2
    Put your regex in quotes in item parameters...
    Code:
    logrt[/var/log/apache2/host.domain.com/access.log," 50\d ",,,skip]

    Comment

    Working...