Ad Widget

Collapse

How to use log/logrt on lines starting with space from previous log-event

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • chojin
    Member
    Zabbix Certified Specialist
    • Jul 2011
    • 64

    #1

    How to use log/logrt on lines starting with space from previous log-event

    I want to monitor the logfile of a program that seems to attach a carriage return and a space after each event, resulting in a log format like this:
    Code:
    yyyy-MM-dd hh:mm:ss,xxx message...
     yyyy-MM-dd hh:mm:ss,xxx message...
     yyyy-MM-dd hh:mm:ss,xxx message...
     ....
    In zabbix I define an item with a log or logrt key to parse this logfile.
    When I set the log time format to "yyyy-MM-dd hh:mm:ss" zabbix only recognises the timestamp of the first line of the log..
    When I set it to "pyyyy-MM-dd hh:mm:ss" (p because a leading space seems to be trimmed out, but matters in this case), zabbix recognises everything except the first line.
    No problem I though at first.. but then when all logging is read en the actual monitoring starts by adding new lines every minute it read the last line, which contains the space of the previous log-event as a new event in zabbix, hence next read cycle, the space is left out from the first read line, as it was already seen by zabbix during previous cycle.. and the date format is not recognised.

    I managed to filter out the blank lines using a regexp in the log/logrt key , but the date format parsing problem remains..

    Anybody knows how to solve this problem?
    btw, the program which log I try to monitor is DBforBIX.
    Last edited by chojin; 21-05-2013, 10:08.
  • Heilig
    Senior Member
    Zabbix Certified Trainer
    Zabbix Certified SpecialistZabbix Certified Professional
    • Mar 2013
    • 366

    #2
    I can't answer on substance of the matter, but offer an alternative option...
    Try to change "ConversationPattern" in "log4j.properties" file or send email about this situation in "SmartMarmot Tech".

    Comment

    • chojin
      Member
      Zabbix Certified Specialist
      • Jul 2011
      • 64

      #3
      Thanks, removing the last newline under the 'ConversationPattern' in the conf/log4j.properties file seems to have solved this problem. The logfiles are now formatted correctly so zabbix doesn't have any problem with it anymore.

      Comment

      Working...