-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
can_read() in read_command.c cause partial output in rare case. #68
Comments
Hi @xmlijhu, The Suggested Workaround: I will escalate this as a potential bug for further review and enhancement. Thank you for bringing this to our attention! Regards |
@juliancnn Thanks for looking at this. From commit history the implementation had been there for quiet a while, but compared to read_fullcommand.c, where the ENTIRE command output is captured and delivered through With this in mind, read_command.c checks other input threads for no apparent reason. |
Hi @jeffery-jen, yes, it is an old code, I think the main reason for this is that all the reader threads leave their tasks as soon as possible so that the main thread can refresh its configs, following this logic I think the can_read() check should be before the command execution, although this does not address the timeout problems. |
A related issue to this is also observed here since 2021 Would any action be taken on this? |
|Wazuh version|Component|Install type|Install method|Platform|
|4.4.3|Logcollector|RPM|Amazon Linux2|
| 4.4.3-40409 | Logcollector| Agent | RPM | AL2|
In rare case, when we run the logcollector with command output, we only get partial command output.
sample configuration in ossec.conf.
In most of the time, the output will output 80 lines of message, however in rare case, it will output less than 80.
After we drilled down, and then built a customized version of wazuh-logcollector with more debug information, we found the culprit is the can_read() function, which is false during the iteration of the fgets().
https://github.com/wazuh/wazuh/blob/master/src/logcollector/read_command.c#L43
In the ossec.log after turn on the debug=2
The text was updated successfully, but these errors were encountered: