Ad Widget

Collapse

get more line with log monitoring

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • alescri
    Member
    • May 2019
    • 32

    #1

    get more line with log monitoring

    hello,
    i saw an ol post about regular expression and log monitoring,
    i have some trouble with it.

    actually my log file is something like that:
    Regular expression tester with syntax highlighting, explanation, cheat sheet for PHP/PCRE, Python, GO, JavaScript, Java, C#/.NET, Rust.


    i found a regular expression that catch more lines but i can't view it on zabbix latest data ,

    the item is:
    log[/workarea/apache-tomcat/apache-tomcat-7.0.47_GA/logs/catalina.out,"(.*[[:space:]]GRAVE:.*)",,,,\1]

    i tried to change the information type to log to text, but i still don't see anything in latest data,

    where I'm wrong?

    hope you can help me,
    thanks
  • dimir
    Zabbix developer
    • Apr 2011
    • 1080

    #2
    The Type of information of the item with key log must be set to Log (otherwise it won't work). If you want to catch the whole line you can just go with
    Code:
    log[/workarea/apache-tomcat/apache-tomcat-7.0.47_GA/logs/catalina.out,"[[:space:]]GRAVE:"]
    or, if you want to catch all after "GRAVE":
    Code:
    log[/workarea/apache-tomcat/apache-tomcat-7.0.47_GA/logs/catalina.out,"[[:space:]](GRAVE:.*)",,,,"\1"]
    It looks like your issue might be that the output is not double-quoted.
    Last edited by dimir; 27-07-2022, 14:01.

    Comment

    • alescri
      Member
      • May 2019
      • 32

      #3
      Originally posted by dimir
      The Type of information of the item with key log must be set to Log (otherwise it won't work). If you want to catch the whole line you can just go with
      Code:
      log[/workarea/apache-tomcat/apache-tomcat-7.0.47_GA/logs/catalina.out,"[[:space:]]GRAVE:"]
      or, if you want to catch all after "GRAVE":
      Code:
      log[/workarea/apache-tomcat/apache-tomcat-7.0.47_GA/logs/catalina.out,"[[:space:]](GRAVE:.*)",,,,"\1"]
      It looks like your issue might be that the output is not double-quoted.
      my idea is to havein latest data the complete log info like
      lug 26, 2022 10:30:25 PM org.zkoss.zk.ui.http.WebManager <init>:179
      GRAVE: File not found: file:///workarea/apache-tomcat/tomcatGA/confapps/GestioneAutorizzazioni/zk-production.xml
      i tried your regexp but it doesn't work,
      actually this one give me back a latest data but i loose some information
      log[/workarea/apache-tomcat/apache-tomcat-7.0.47_GA/logs/catalina.out,GRAVE,,,,]
      in regex101 your regex works but zabbix's latest data are blank

      we use zabbix version 5.2.7

      any ideas?
      Last edited by alescri; 27-07-2022, 15:15.

      Comment

      • alescri
        Member
        • May 2019
        • 32

        #4
        (.*[[:alpha:]] [[:alnum:]].*\nGRAVE.*)
        works on regexp101 but not on zabbix

        Comment

        • dimir
          Zabbix developer
          • Apr 2011
          • 1080

          #5
          And this one:
          Code:
          log[/workarea/apache-tomcat/apache-tomcat-7.0.47_GA/logs/catalina.out,"\sGRAVE:"]
          ?

          Comment

          • Markku
            Senior Member
            Zabbix Certified SpecialistZabbix Certified ProfessionalZabbix Certified Expert
            • Sep 2018
            • 1782

            #6
            Does using multiline option (https://www.pcre.org/current/doc/htm...tax.html#SEC16) (?m) change something? I mean, in regex101 it is set (the "m" in "gm").

            Markku

            Comment

            • Hamardaban
              Senior Member
              Zabbix Certified SpecialistZabbix Certified Professional
              • May 2019
              • 2713

              #7
              Multiline is not supported in log regex at zabbix.
              Each line is processed separately!
              As Markku wrote….

              Comment

              • alescri
                Member
                • May 2019
                • 32

                #8
                Originally posted by dimir
                And this one:
                Code:
                log[/workarea/apache-tomcat/apache-tomcat-7.0.47_GA/logs/catalina.out,"\sGRAVE:"]
                ?
                neither... as other member wrote probably multiline is not supported ....

                Comment

                • alescri
                  Member
                  • May 2019
                  • 32

                  #9
                  Originally posted by Hamardaban
                  Multiline is not supported in log regex at zabbix.
                  Each line is processed separately!
                  As Markku wrote….
                  thanks i hope it will be implemented

                  Comment

                  • dimir
                    Zabbix developer
                    • Apr 2011
                    • 1080

                    #10
                    Oh man, you have endline there (\n), correct, line by line only, currently...

                    In your case I'd just go with the
                    Code:
                    log[/workarea/apache-tomcat/apache-tomcat-7.0.47_GA/logs/catalina.out,"^GRAVE:"]
                    Note, "^" means the beginning of the line.
                    Last edited by dimir; 28-07-2022, 01:11.

                    Comment

                    Working...