Ad Widget

Collapse

Problem with log[] and regex pattern

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ezibecchi
    Junior Member
    • Apr 2014
    • 3

    #1

    Problem with log[] and regex pattern

    Hi guys!

    I have been using zabbix for a couple of months and it is a great product!!! I keep adding items and checks!

    But now I have a problem, and it very confusing


    Scenario
    • Server Zabbix 2.2 under Ubuntu 12.04 LTS
    • Client Windows 2003R2, active agent 2.2.1

    Everything (except this is working ok).

    I have created a new item : log["C:\Zabbix\testlog.txt",Error,,,] but….. I don't get changes to the file.
    I have tried
    • Change the file name (it gives an error saying that the file does not exists). So I assume that it is checking ok the file
    • Change the item to log["C:\Zabbix\testlog.txt",,,,] without a regex. In this case it reports changes to the file correctly but I need the information of the errors (if it occurs)

    What I think is that it is not interpreting the regex…… I have tried with
    • log["C:\Zabbix\testlog.txt",Error,,,]
    • log["C:\Zabbix\testlog.txt","Error",,,]
    • log["C:\Zabbix\testlog.txt","Error","UTF-8",,]

    But it doesn't work. And when I go to debug mode 4 in the agent it always says that the value is '' (not null) and when it converts to utf_8 it always returns ''

    Any ideas??? Obviously I am doing something wrong…….

    Thanks for your time

    Esteban
  • Divya
    Junior Member
    • Apr 2014
    • 6

    #2
    Try changing the format of file from .txt to .log

    Comment

    • ezibecchi
      Junior Member
      • Apr 2014
      • 3

      #3
      Windows parsing of text files

      Thanks for your reply Divya, sorry it took me so long to answer but I was running different tests trying to find out what was going on.

      Your answer gave a clue so I began testing with different .log files and the conclusions are

      * If I use a .log file from Ubuntu (or any other linux) it works great
      * If I use a .log file from Windows (any version) it won't parse it.

      I know that plain text files in Windows are different from Linux, so I am guessing that it is related to that.

      I have already tried to change the encode to "ASCII" and "ANSI" but it is still not working

      As you can see from this part of the agent log file, the convert_to_utf8() function is always returning ''

      1724:20140422:091259.734 convert_to_utf8() in_size:30 encoding:'ANSI' codepage:0
      1724:20140422:091259.734 convert_to_utf8() utf8_size:30 utf8_string:''


      If anyone has a tip...... it is driving me crazy!!

      Comment

      • ezibecchi
        Junior Member
        • Apr 2014
        • 3

        #4
        Solved!

        Just to report that I have solved it using encode : UTF-16

        Now the text files in windows are procesed correctly!

        Thanks for your time

        Esteban

        Comment

        Working...