Ad Widget

Collapse

Logrt for monitoring files with data in name

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Konrad_22
    Junior Member
    • Oct 2020
    • 6

    #1

    Logrt for monitoring files with data in name

    Hi guys,
    My problem is that i would like to monitor few files in one directory, <D:\logs>, every name starts with data like <2020-11-19_app.log> and app creates new file everyday.
    Im trying to use logrt but i cant solve this problem.

    im trying with something like this, i checked regex101 and it should find this file,
    logrt["D:/.*.log","error"]

    Please help me and thank you

    Do you have any idea how i could check logs for errors, warns etc but not with .*.log? any idea how i could connect data with file name?
    for example today i would like to scan only files which starts with 2020-11-19
    Last edited by Konrad_22; 19-11-2020, 15:40.
  • Hamardaban
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • May 2019
    • 2713

    #2
    logrt["D:\\\d{4}-\d{2}-\d{2}_app\.log","error"]

    Comment

    • Konrad_22
      Junior Member
      • Oct 2020
      • 6

      #3
      I still have problem with that file, the string with localisation looks ok but i get my data only when file localisation is not set as regex

      any solutions?
      Attached Files
      Last edited by Konrad_22; 20-11-2020, 12:17.

      Comment

      • Konrad_22
        Junior Member
        • Oct 2020
        • 6

        #4
        Could someone tell me where the regex should start in the file path? for example file name
        logrt["D:\app\zabbix\logs\\\d{4}-\d{2}-\d{2}_app\.log","error"]
        is ok? because zabbix cant reach this localisation

        Comment

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

          #5
          I have this version of the expression that works:
          Code:
          logrt["D:\app\zabbix\logs\^\d{4}-\d{2}-\d{2}_app\.log$","error"]
          in this expression, the regular expression describes only the file name.

          Comment

          • Konrad_22
            Junior Member
            • Oct 2020
            • 6

            #6
            sure but why it cant find any errors? i have same problem zabbix find files .*.log but cant find errors, warnings etc

            Comment

            • cyber
              Senior Member
              Zabbix Certified SpecialistZabbix Certified Professional
              • Dec 2006
              • 4807

              #7
              logrt["D:\\app\\zabbix\\logs\\\d{4}-\d{2}-\d{2}_app\.log","error"] missing couple of \-s, I think.

              Comment

              • cyber
                Senior Member
                Zabbix Certified SpecialistZabbix Certified Professional
                • Dec 2006
                • 4807

                #8
                Just out of curiosity
                Added a file to a box, I have here .. C:\apps\logs\2020-11-20_app.log
                added an item
                logrt["C:\app\logs\^\d{4}-\d{2}-\d{2}_app\.log$","error"]
                It became "Not supported": Cannot compile a regular expression describing filename pattern: PCRE does not support \L, \l, \N{name}, \U, or \u
                changed to
                logrt["C:\\app\\logs\\^\d{4}-\d{2}-\d{2}_app\.log$","error"]
                Became supported...
                Using 4.4.10 here...

                It still fails to find any "error"-s I write in there, but that's another story...

                Comment

                • cyber
                  Senior Member
                  Zabbix Certified SpecialistZabbix Certified Professional
                  • Dec 2006
                  • 4807

                  #9
                  Good question.. I found an aswer from agent logfile
                  1340:20201120:142105.961 there are no recently modified files matching "app\\logs\\^\d{4}-\d{2}-\d{2}_app\.log$" in "C:"

                  I had made a mistake.. one missing s in path..
                  After that also the version what Hamardaban suggested works, with single \-s
                  EDIT: point being... look int agent logfile, maybe you find something useful there..

                  Comment

                  Working...