[ZBX-7301] The logrt go unsupported state when the log rotates Created: 2013 Nov 06  Updated: 2017 May 30  Resolved: 2014 Apr 28

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

Type: Incident report Priority: Minor
Reporter: Oleg Ivanivskyi Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: logrt
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Zabbix Agent (daemon) v2.0.9 (revision 39085)


Attachments: File agent_debug     Text File agent_debug1.txt    
Issue Links:
Duplicate

 Description   

If during the intensive reading a log file is rotated, then item goes to unsupported state.

Example, we have a rapidly growing log file zabbix_agentd.log1, after executing commands that simulate rotation:
mv -f zabbix_agentd.log1 zabbix_agentd.log1.old; touch zabbix_agentd.log1
or
rm -f zabbix_agentd.log1; touch zabbix_agentd.log2
item "logrt["/var/log/zabbix/zabbix_agentd.log[1-9]$","error",,,skip]" with a high probability will go into "Not supported" state with error:
25754:20131106:133050.854 cannot process read entry '/var/log/zabbix/..'
25754:20131106:133050.855 cannot stat '/var/log/zabbix/zabbix_agentd.log1': [2] No such file or directory



 Comments   
Comment by Oleksii Zagorskyi [ 2013 Nov 07 ]

ZBX-7098 could be related

Comment by Andris Zeila [ 2013 Nov 08 ]

Fixed in development branch svn://svn.zabbix.com/branches/dev/ZBX-7301

Comment by Oleg Ivanivskyi [ 2013 Nov 18 ]

After applying the patch to the test, I still can reproduce the problem (in the above method).

wiper If you were trying 'rm <logfile1>;touch <logfile2>', was the <logfile1> the only file matching the target pattern? If so then item could become unsupported as logrt[] is unsupported if there are no matching files.

oleg.ivanivskyi Yes that's right, only file <logfile1> was matching the target pattern. But it is a normal situation when you rotate files - old moved/deleted and a new created. The file doesn’t exist less than a second. Maybe it's better to check a couple of times that the file doesn’t exist?
I think that it is not normal that after each rotation, the status of item changes to "Not supported".

zalex_ua Oleg is right !
Moreover, previously the logrt key worked ok (not become unsupported) even if there are not matching log files. It was desired behavior for zabbix users etc. If this point going to be changed - we need to be more careful and discuss it first.

wiper Judging from code and testing of the 2.0 branch logrt[] becomes unsupported when there are no matching log files.

Comment by Oleg Ivanivskyi [ 2013 Nov 19 ]

Updated debug info from the agent.

Comment by Andris Zeila [ 2013 Nov 27 ]

As there are no consensus on how this issue should be handled I'm moving ZBX-7098 fix into its own branch.

Comment by Andris Mednis [ 2014 Feb 19 ]

This issue is being fixed as part of resolving ZBX-6731 (currently in testing).

Planned for log[] items:

  • if there is no file (or it is not readable) then go into NOTSUPPORTED state.

Planned for logrt[] items:

  • if there are no files matching the file mask then write a warning into agent log, but do not go into NOTSUPPORTED state,
  • if there is no directory (or it is not readable) where the log files are expected to be then write a warning into agent log and go into NOTSUPPORTED state.
Comment by Andris Mednis [ 2014 Apr 28 ]

Fixed in versions pre-2.0.12 r43102, pre-2.2.3 r43233, pre-2.3.0 r43239 (the same as solution for ZBX-6731).

Comment by Andris Zeila [ 2014 Apr 29 ]

Successfully tested

Generated at Thu Apr 25 19:02:06 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.