-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
in_exec: allow for long-running commands #732
Conversation
cc: @nokute78 |
plugins/in_exec/in_exec.c
Outdated
follow = flb_input_get_property("follow", in); | ||
if (follow != NULL) { | ||
if (strcasecmp(follow, "true") == 0) { | ||
exec_config->follow = 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We defined FLB_TRUE/FLB_FALSE at flb_macros.h. Would you replace it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated the code to make use of the FLB_TRUE/FLB_FALSE macros.
exec_config->argv[argc] = NULL; | ||
|
||
/* follow setting */ | ||
follow = flb_input_get_property("follow", in); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refer to in_exec of fluentd, run_interval
option means follow
mode or not.
https://docs.fluentd.org/v1.0/articles/in_exec#run_interval
I means,
I think we don't need new option "follow".
If Interval_Sec
and Interval_NSec
are not set, exec_config->follow
is FLB_TRUE. (= run_interval is not set)
if Interval_Sec
or/and Interval_NSec
is/are set, exec_config->follow
is FLB_FALSE. (= run_interval is set)
Default value of Interval_Sec
and Interval_NSec
are 0.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: We support fd event based API flb_input_set_collector_event
. (e.g. in_kmsg uses this API)
I think the follow mode is not time based mode. How about trying to use it?
flb_input_set_collector_event(in,
in_exec_collect,
fileno(exec_config->cmdp),
config);
@j0057 I commented on your commit. Defunct process will be generated if user set such configuraion. [INPUT]
Name exec
Tag exec_ls
Command ls /var/log
follow true
[OUTPUT]
Name stdout
Match * |
@j0057 ping |
Add a boolean option (follow) to in_exec plugin to read the spawned process output using non-blocking I/O, this way Fluent-bit can capture the output of commands that never exit, for example `vmstat -S M 10`. Signed-off-by: Joost Molenaar <[email protected]>
Signed-off-by: Joost Molenaar <[email protected]>
Signed-off-by: Joost Molenaar <[email protected]>
@nokute78 is this ready to go after the latest changes or it needs some changes ? |
@nokute78 ping |
@edsiper Sorry for late reply. I proposed 3 items and 1 of it was fixed.
|
Hi @edsiper, life is currently not allowing me to invest the time needed to see this pull request through to its completion. I think rewriting it to use the event-based API would cost me at least a few days to learn about the concepts involved -- the PR as it is took me about 8 hours, because I'm not very fluent in C. I'm sorry for wasting your time and not closing the PR sooner. @nokute78, thank you for reviewing my code, my apologies to you as well. |
Thanks anyways for the effort on this, no worries, it's just code :) no waste of time, have a great 2019! @nokute78 thank you for reviewing and help on this |
Add a boolean option (follow) to in_exec plugin to read the spawned
process output using non-blocking I/O, this way Fluent-bit can capture
the output of commands that never exit, for example
vmstat -S M 10
.Signed-off-by: Joost Molenaar [email protected]