Ad Widget

Collapse

Problems with reading text/log file

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mkmb
    Junior Member
    • Jul 2020
    • 8

    #1

    Problems with reading text/log file

    Hello all,

    I am having trouble setting up a simple text/log file monitoring.
    We are using a PowerShell script which puts out a log file.
    The format looks like this:

    Code:
    2022-01-07T12:46:02.2289799+01:00 - INFO - scanning C:\ E:\ on WSUS
    2022-01-07T12:46:02.2445753+01:00 - INFO - Powershell Version: 5.1.17763.2268
    2022-01-07T12:46:02.2445753+01:00 - INFO - Windows 10.0.17763.0
    2022-01-07T12:46:02.6820888+01:00 - INFO - checking C:\Program Files\Microsoft SQL Server\150\DTS\Extensions\Common\Jars\commons-codec-1.4.jar
    2022-01-07T12:46:02.6976925+01:00 - INFO - checking C:\Program Files\Microsoft SQL Server\150\DTS\Extensions\Common\Jars\commons-collections-3.2.1.jar
    2022-01-07T12:46:02.7133122+01:00 - INFO - checking C:\Program Files\Microsoft SQL Server\150\DTS\Extensions\Common\Jars\commons-configuration-1.6.jar
    2022-01-07T12:46:02.7289722+01:00 - INFO - checking C:\Program Files\Microsoft SQL Server\150\DTS\Extensions\Common\Jars\commons-lang-2.6.jar
    2022-01-07T12:46:02.7289722+01:00 - INFO - checking C:\Program Files\Microsoft SQL Server\150\DTS\Extensions\Common\Jars\commons-logging-1.1.3.jar
    2022-01-07T12:46:02.7445716+01:00 - INFO - checking C:\Program Files\Microsoft SQL Server\150\DTS\Extensions\Common\Jars\hadoop-auth-2.6.0.2.2.0.0-2041.jar
    2022-01-07T12:46:02.7445716+01:00 - INFO - checking C:\Program Files\Microsoft SQL Server\150\DTS\Extensions\Common\Jars\hadoop-common-2.6.0.2.2.0.0-2041.jar
    2022-01-07T12:46:02.7758320+01:00 - INFO - checking C:\Program Files\Microsoft SQL Server\150\DTS\Extensions\Common\Jars\hadoop-mapreduce-client-common-2.6.0.2.2.0.0-2041.jar
    2022-01-07T12:46:02.7914456+01:00 - INFO - checking C:\Program Files\Microsoft SQL Server\150\DTS\Extensions\Common\Jars\hadoop-mapreduce-client-core-2.6.0.2.2.0.0-2041.jar
    2022-01-07T12:46:02.7914456+01:00 - INFO - checking C:\Program Files\Microsoft SQL Server\150\DTS\Extensions\Common\Jars\hive-exec-2.1.0.jar
    2022-01-07T12:46:02.9789508+01:00 - INFO - checking C:\Program Files\Microsoft SQL Server\150\DTS\Extensions\Common\Jars\HiveOrcBridg e-1.0.jar
    2022-01-07T12:46:02.9945646+01:00 - INFO - checking C:\Program Files\Microsoft SQL Server\150\DTS\Extensions\Common\Jars\log4j-1.2.17.jar
    2022-01-07T12:46:02.9945646+01:00 - INFO - checking C:\Program Files\Microsoft SQL Server\150\DTS\Extensions\Common\Jars\slf4j-api-1.7.5.jar
    2022-01-07T12:46:02.9945646+01:00 - INFO - checking C:\Program Files\Microsoft SQL Server\150\DTS\Extensions\Common\Jars\slf4j-log4j12-1.7.5.jar
    2022-01-07T12:46:03.0101942+01:00 - INFO - checking C:\Program Files\Microsoft SQL Server\150\DTS\Extensions\Common\Jars\snappy-java-1.1.1.6.jar
    2022-01-07T12:46:03.9164532+01:00 - INFO - checking C:\Program Files (x86)\Microsoft SQL Server Management Studio 18\Common7\IDE\CommonExtensions\Microsoft\SSIS\150 \Extensions\Common\Jars\commons-codec-1.4.jar
    2022-01-07T12:46:03.9164532+01:00 - INFO - checking C:\Program Files (x86)\Microsoft SQL Server Management Studio 18\Common7\IDE\CommonExtensions\Microsoft\SSIS\150 \Extensions\Common\Jars\commons-collections-3.2.1.jar
    2022-01-07T12:46:03.9164532+01:00 - INFO - checking C:\Program Files (x86)\Microsoft SQL Server Management Studio 18\Common7\IDE\CommonExtensions\Microsoft\SSIS\150 \Extensions\Common\Jars\commons-configuration-1.6.jar
    2022-01-07T12:46:03.9164532+01:00 - INFO - checking C:\Program Files (x86)\Microsoft SQL Server Management Studio 18\Common7\IDE\CommonExtensions\Microsoft\SSIS\150 \Extensions\Common\Jars\commons-lang-2.6.jar
    2022-01-07T12:46:03.9320739+01:00 - INFO - checking C:\Program Files (x86)\Microsoft SQL Server Management Studio 18\Common7\IDE\CommonExtensions\Microsoft\SSIS\150 \Extensions\Common\Jars\commons-logging-1.1.3.jar
    2022-01-07T12:46:03.9320739+01:00 - INFO - checking C:\Program Files (x86)\Microsoft SQL Server Management Studio 18\Common7\IDE\CommonExtensions\Microsoft\SSIS\150 \Extensions\Common\Jars\hadoop-auth-2.6.0.2.2.0.0-2041.jar
    2022-01-07T12:46:03.9320739+01:00 - INFO - checking C:\Program Files (x86)\Microsoft SQL Server Management Studio 18\Common7\IDE\CommonExtensions\Microsoft\SSIS\150 \Extensions\Common\Jars\hadoop-common-2.6.0.2.2.0.0-2041.jar
    2022-01-07T12:46:03.9476977+01:00 - INFO - checking C:\Program Files (x86)\Microsoft SQL Server Management Studio 18\Common7\IDE\CommonExtensions\Microsoft\SSIS\150 \Extensions\Common\Jars\hadoop-mapreduce-client-common-2.6.0.2.2.0.0-2041.jar
    2022-01-07T12:46:03.9476977+01:00 - INFO - checking C:\Program Files (x86)\Microsoft SQL Server Management Studio 18\Common7\IDE\CommonExtensions\Microsoft\SSIS\150 \Extensions\Common\Jars\hadoop-mapreduce-client-core-2.6.0.2.2.0.0-2041.jar
    2022-01-07T12:46:03.9633448+01:00 - INFO - checking C:\Program Files (x86)\Microsoft SQL Server Management Studio 18\Common7\IDE\CommonExtensions\Microsoft\SSIS\150 \Extensions\Common\Jars\HiveOrcBridge-1.0.jar
    2022-01-07T12:47:01.9795140+01:00 - INFO - Result: PASS
    I have now set up an Item in Zabbix using type "Zabbix agent (active)" and key "log[C:\scripts\folder\file.log]"
    When selecting Type of information "Log", the Item never returns any data, but recognizes the file being there.

    When switching the type of information to "Text", the Item returns the content, but with a question mark before every character, like this:
    Click image for larger version

Name:	Screenshot 2022-01-07 110723.png
Views:	663
Size:	8.4 KB
ID:	437848

    Does anyone have a hint on how to get the actual text from the file to work with?
    I also tried several encoding options in the Item key, but nothing changed.
  • cyber
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Dec 2006
    • 4807

    #2
    Some kind of charset issue? For log[] item you can set encoding as third parameter.

    Comment

    • mkmb
      Junior Member
      • Jul 2020
      • 8

      #3
      Originally posted by cyber
      Some kind of charset issue? For log[] item you can set encoding as third parameter.
      I was suspecting that as well.
      But I have never seen an encoding issue that shows additional characters instead of replacing unknown ones.

      Notepad++ shows the encoding of the log file as UTF-16 LE-BOM.
      Already tried encoding with the log[] key with the most used ones like UTF-16 LE, UTF-8, ASCII, and ISO-8859-1 to no avail.

      Comment

      • pmvr
        Junior Member
        • Aug 2023
        • 1

        #4
        I know there is no more answers.
        But i have come across the same problem, changing the encoding only leads to no updates from item.
        Anyone got a solution to this

        Comment

        Working...