[ZBX-13254] Log monitoring in the first time "No such file or directory" on skip mode Created: 2017 Oct 12  Updated: 2024 Apr 10  Resolved: 2018 Jan 07

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Agent (G)
Affects Version/s: None
Fix Version/s: 3.0.15rc1, 3.4.6rc1, 4.0.0alpha2, 4.0 (plan)

Type: Incident report Priority: Major
Reporter: Kim Jongkwon Assignee: Andris Mednis
Resolution: Fixed Votes: 0
Labels: logmonitoring
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
Team: Team A
Team: Team A
Sprint: Sprint 19, Sprint 21, Sprint 22, Sprint 23, Sprint 24
Story Points: 2

 Description   

When using "skip" mode, be able to check "No such file".
Currently, logs will be skipped when creating file.

Steps to reproduce:
1. Create a new log item key (No file with skip mode)

- log[/tmp/logtest.log,,,,skip,]

Zabbix logs occurred in 2 minutes active check

active check "log[/tmp/logtest.log,,,,skip,]" is not supported: Cannot obtain information for file "/tmp/logtest.log": [2] No such file or directory

2. Create a new file for monitoring

echo Error_1 > /tmp/logtest.log / Create a new log
echo Error_2 >> /tmp/logtest.log
echo Error_3 >> /tmp/logtest.log

"No such file" error disappears. but error_1~3 does not contained history data (skipped)

3. Remove "/tmp/logtest.log" file.
"No such file" error will start showing again.

4. Recreate a new file "/tmp/logtest.log"

echo Error_4 > /tmp/logtest.log?/ Create a new file
echo Error_5 >> /tmp/logtest.log
echo Error_6 >> /tmp/logtest.log

Start collecting logs from here.



 Comments   
Comment by Andris Mednis [ 2017 Dec 28 ]

Seems like a bug.
Correct behavior would be this:
when a new log[] or logrt[] item is created with "skip" parameter and during the first check a file is not available then "skip" flag is reset and further checks go from lastlogsize = 0 (no skipping).

Comment by Andris Mednis [ 2017 Dec 28 ]

Resetting skip flag should be done only in case "file does not exist (or is not available)".
In case of other errors (e.g. file exists but is not a regular file (it is a socket or directory), cannot determine file system type (on MS Windows), file name regexp does not compile (for logrt[]), specified directory does not exist/not accessible) I think we do not need to reset skip flag as user is going to edit the item key to make it work at all.

Comment by Andris Mednis [ 2017 Dec 30 ]

I have solution in svn://svn.zabbix.com/branches/dev/ZBX-13254 (for 3.0) which passes test from description.
(The solution is not yet passed to peer review).
The idea is to keep log[] and logrt[] items in the list in case they are NOTSUPPORTED to remember the fact that 'skip_old_data' was once reset because "file does not exist" and further checks do not apply 'skip' anymore. This works but I think it brings a new problem - if the item is deleted from DB and recreated with the same key and 'skip', then it does not 'skip' as user expects for a new item (unless agent is rebooted).
I do not yet see how can we distinguish an old item check for which 'skip' is not allowed anymore from a new item check recreated with the same key for which 'skip' should be enabled.

Comment by Marc [ 2017 Dec 30 ]

How about putting the itemid into consideration?

Comment by Andris Mednis [ 2017 Dec 31 ]

Yes, itemid could work, but then also server and proxy have to be modified - to send the itemid in the list of active checks to agent.

Comment by Andris Mednis [ 2018 Jan 02 ]

It was decided that adding an itemid to active check list JSON which requires modification of server and proxy is a change of protocol and exceeds the scope of this ZBX. It should be solved in a separate ZBX.
As of this ZBX-13254, its solution will not include detection of item-deleted-and-recreated-with-same-key-and-skip-is-enabled-again case.

Comment by Andris Mednis [ 2018 Jan 02 ]

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

Comment by Vladislavs Sokurenko [ 2018 Jan 03 ]

Successfully tested development branch for 3.0
svn://svn.zabbix.com/branches/dev/ZBX-13254

Comment by Andris Mednis [ 2018 Jan 04 ]

For 3.4 fixed in development branch svn://svn.zabbix.com/branches/dev/ZBX-13254-34

Comment by Vladislavs Sokurenko [ 2018 Jan 04 ]

Successfully tested

Comment by Andris Mednis [ 2018 Jan 04 ]

Available in versions:

  • pre-3.0.15rc1 r76564
  • pre-3.4.6rc1 r76565
  • pre-4.0.0alpha2 (trunk) r76567
Comment by Andris Mednis [ 2018 Jan 04 ]

Documented in
https://www.zabbix.com/documentation/3.0/manual/introduction/whatsnew3015#item_changes
https://www.zabbix.com/documentation/3.0/manual/installation/upgrade_notes_3015#item_changes
https://www.zabbix.com/documentation/3.4/manual/introduction/whatsnew346#item_changes
https://www.zabbix.com/documentation/3.4/manual/installation/upgrade_notes_346#item_changes

martins-v Reviewed, CLOSED. Note that I changed the wording a little bit.

andris Thanks, martins-v!

Generated at Sat Apr 20 07:12:01 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.