[ZBX-8238] logrt may continue reading an old file repeatedly. Created: 2014 May 21  Updated: 2017 May 30  Resolved: 2014 May 26

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Agent (G)
Affects Version/s: 2.0.12, 2.2.3
Fix Version/s: 2.0.13rc1, 2.2.4rc1, 2.3.1

Type: Incident report Priority: Blocker
Reporter: Yoshinori Komuro Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: logrt
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

RHEL6.5


Attachments: Text File for_2.2.3.patch     File zbx-8238-2.0.12.patch     File zbx-8238-2.2.3.patch    

 Description   

When the size of a file new after log rotation is 0 byte, reading the log of an old file will be continued.

--after log rotation
Zabbix
key_=logrt[/var/log/test.log]
lastlogsize=1000
mtime=5/16 19:23

old file
filename=test.log-20140517
logsize=1000
mtime=5/16 19:23

new file
filename=test.log
logsize=0
mtime=5/17 03:06

--In process_logrt() First

?process_log()
It reads to the last of the old file.
?if (i != logfiles_num - 1)
lastlogsize is set as zero.
?process_log()
Since file size is the same as lastlogsize, mtime is not updated but it returns SUCCESS.

lastlogsize=0 ?Only lastlogsize is updated.
mtime=5/16 19:23

--In process_logrt() Second....

?process_log()
It reads to the last of the old file.
?if (i != logfiles_num - 1)
lastlogsize is set as zero.
?process_log()
Since file size is the same as lastlogsize, mtime is not updated but it returns SUCCESS.

lastlogsize=0 ?Only lastlogsize is updated.....
mtime=5/16 19:23



 Comments   
Comment by Oleksii Zagorskyi [ 2014 May 22 ]

Might be duplicate of ZBX-7098.
Yoshinori, please review.

Comment by Andris Mednis [ 2014 May 22 ]

This is not a duplicate of ZBX-7098. It is a regression caused by my fix of ZBX-6729 and ZBX-6731, affecting 2.0.12 and 2.2.3.
Yesterday a fix for ZBX-7098 was committed into 2.0.13rc1, 2.2.4rc1. I was not able to reproduce the issue ZBX-8238 with the fix ZBX-7098.

Comment by Andris Mednis [ 2014 May 22 ]

Thanks, Yoshinori, for reporting the issue and patch! Small modification of patch

+		if (NULL != mtime)
+			*mtime = (int)buf.st_mtime;

to prevent crash on log[] items.

Comment by Andris Mednis [ 2014 May 23 ]

Documented in "Known issues"
https://www.zabbix.com/documentation/2.0/manual/installation/known_issues
https://www.zabbix.com/documentation/2.2/manual/installation/known_issues

Comment by Andris Mednis [ 2014 May 26 ]

Patches for 2.0.12 and 2.2.3 available in attachments. Please review and test.

wiper 2.0.12 patch successfully tested

Comment by Andris Mednis [ 2014 May 26 ]

While not absolutely necessary, this patch improves also current 2.0 and 2.2 (with fix ZBX-7098 applied). For Zabbix 2.0 available in development branch svn://svn.zabbix.com/branches/dev/ZBX-8238-20.

wiper Tested ZBX-8238-20 dev branch

Comment by Andris Mednis [ 2014 May 28 ]

Fixed in versions pre-2.0.13 r45917, pre-2.2.4 r45927, pre-2.3.1 r45931.

Comment by Volker Fröhlich [ 2014 Jun 04 ]

A backported patch for this issue is used in the following Fedora/EPEL packages:

zabbix-2.0.12-2.fc19
zabbix-2.0.12-2.fc20
zabbix-2.2.3-3.fc21
zabbix20-2.0.12-1.el5
zabbix20-2.0.12-1.el6
zabbix20-2.0.12-2.el7

Generated at Sat Apr 27 03:08:23 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.