[ZBX-9195] When receiving data of ZBX_NOTSUPPORTED, Proxy sets invalid value to lastlogsize and mtime. Created: 2015 Jan 08  Updated: 2017 May 30  Resolved: 2015 Jan 12

Status: Closed
Component/s: Proxy (P)
Affects Version/s: 2.0.12, 2.0.13, 2.0.14
Fix Version/s: 2.0.15rc1, 2.2.9rc1, 2.4.4rc1, 2.5.0

Type: Incident report Priority: Blocker
Reporter: Yoshinori Komuro Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: eventlog, log, logrt

Attachments: File for_2.0.14.patch    


When receiving data of ZBX_NOTSUPPORTED, though Proxy doesn't set any value to lastlogsize and mtime in DCadd_history_notsupported(),
Proxy uses them in DCmass_proxy_update_items().

Therefore Proxy sets invalid value to lastlogsize and mtime, and when restarting Agent, it re-reads log from the first wrongly.

Comment by Aleksandrs Saveljevs [ 2015 Jan 08 ]

Note that ZBXNEXT-444 is meant to address a related problem in trunk.

Comment by Aleksandrs Saveljevs [ 2015 Jan 09 ]

Fixed in development branch svn://svn.zabbix.com/branches/dev/ZBX-9195 (based on 2.0) by applying the suggested patch.

Comment by Aleksandrs Saveljevs [ 2015 Jan 09 ]

Upon deeper investigation it turned out that this problem is independent from ZBXNEXT-444 and should be fixed separately under this issue.

Comment by Alexander Vladishev [ 2015 Jan 12 ]

(1) Please take a look at my changes in r51519.

Aleksandrs Saveljevs Logic looks good, but that commit introduced some extra whitespace. Fixed that in r51521, please take a look. RESOLVED.

Alexander Vladishev CLOSED

Comment by Aleksandrs Saveljevs [ 2015 Jan 12 ]

Fixed in pre-2.0.15 r51524, pre-2.2.9 r51525, pre-2.4.4 r51526, and pre-2.5.0 (trunk) r51527.

Comment by Kazuo Ito [ 2015 Mar 05 ]

using log4j, was subjected to the output of a large amount of log.
mtime is the same but, size is different.
Getting mtime and size, not synchronized?

 19639:20150305:133344.353    nr:0 filename:'/var/log/tomcat/mylog.log' mtime:1425530023 size:26680 processed_size:7480 seq:1 incomplete:0 dev:2049 ino_hi:0 ino_lo:653899 md5size:512 md5buf:bf528b17e422783459c713ca9152cee7
 19639:20150305:133344.353    nr:0 filename:'/var/log/tomcat/mylog.log' mtime:1425530023 size:37900 processed_size:7480 seq:0 incomplete:0 dev:2049 ino_hi:0 ino_lo:653899 md5size:512 md5buf:bf528b17e422783459c713ca9152cee7


import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class test extends HttpServlet {
  protected Log log = LogFactory.getLog(this.getClass());

  public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException {

    log.debug("message DEBUG ************************************************************");
    log.info ("message INFO");
    log.warn ("message WARN");
    log.error("message ERROR");
    log.fatal("message FATAL");

    PrintWriter rw = res.getWriter();

test shell

for i in `seq 1 6000`
   curl -s 'xxx.xxx.xxx.xxx/log4j/test'


<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" >
  <appender name="stdout" class="org.apache.log4j.ConsoleAppender">
     <param name="Target" value="System.out" /> 
     <param name="Encoding" value="UTF8" />
     <layout class="org.apache.log4j.PatternLayout">
        <param name="ConversionPattern" value="%d %5p %c{1} - %m%n" />
  <appender name="file" class="org.apache.log4j.RollingFileAppender">
     <param name="File" value="/var/log/tomcat/mylog.log" />
     <param name="Append" value="true" />
     <param name="MaxFileSize" value="51200" />
     <param name="MaxBackupIndex" value="10" />
     <param name="ImmediateFlush" value="true" />
     <param name="Encoding" value="UTF8" />
     <layout class="org.apache.log4j.PatternLayout">
	<param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss.SSS} %-5p %C:%M:%m%n" />
  <category name="test" >
    <priority value ="debug" />
    <appender-ref ref="file" />
    <priority value ="info" />
    <appender-ref ref="stdout"/>
Generated at Fri Jan 18 09:21:08 EET 2019 using JIRA 7.3.9#73021-sha1:26adfd3d76803e1a04219c5cd05b58dbafff0dbf.