-
Notifications
You must be signed in to change notification settings - Fork 638
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
Introduce dynamic configuartion reload global option #4783
base: master
Are you sure you want to change the base?
Conversation
This pull request introduces 2 alerts when merging e4887d2 into 66a2692 - view on LGTM.com new alerts:
|
@davidelang your feedback on the topic is highly appreciated! |
@Cropi I think ubuntu 20 [T]SAN have valid complaints ;-) |
would it make sense to split this off to a separate PR or at least commit? I think this is laying ground for many changes to come and so IMHO it deserves to stand out in git history. |
Yes, you are right:D
Of course, I will divide it into smaller chunks. There are some parts that will require changes but I wanted to execute the CI. |
reloading configs is both an easy thing and a horribly hard thing, depending on
how much the configs are changing. Can you go into a little detail about what
sorts of things you are expecting to change?
for example, adding additional inputs feeding into existing queue is relatively
easy (and even for such a simple thing, it's an extremely useful feature to
have)
but making major changes to the flow of logs through multiple queues, changing
queue names, and outputting to multiple places is an extremely complex problem
that can leave logs orphaned in queues very easily. When you have the new config
using different modules, it gets even messier as the allowed syntax changes
depending on what modules are loaded.
In between you have a 'normal' config where you don't have a complex flow, and
are just working through the main queue outputting to different destinations
(where any additional queues that are in use are only tied to a particular
action, so if that queue doesn't appear in the new config, you could leave it in
place with it's existing action to finish processing pending messages)
I'll look through this PR later today, but if you could give us an idea of the
scope that you are looking at (and a rough roadmap of the steps that you are
thinking of) it would be useful.
David Lang
|
> New global directive is introduced - hup.reload.config. If set to "on", rsyslog will dynamically reload its configuration(right now only imtcp is implemented to do so). Otherwise, old behavior is used.
I think we want this directive to be more nuanced than 'on' 'off' (see my other
comment about the possible complexity)
David Lang
|
let me chime in. The goal here is actually to do the hard and complex thing, so we probably do not need the nuances. As code and PR develops, of course, I think @Cropi will go from least to more complex things. |
Thank you @davidelang for the constructive feedback. I did not specify in the description what I really want to accomplish with this PR, sorry for that. My long term goal would be to dynamically reload the entire config file via sending a HUP signal to rsyslog. I know that this task is extremely large and will certainly require lot of changes in the project. All I wanted to accomplish in this PR, is to provide a way to dynamically reload the
I totally agree that the hup.reload.config directive will require some changes and it won't be as simple as it is now. I will divide the PR into smaller parts later today and address issues discovered by CI. |
e4887d2
to
13ba861
Compare
This pull request introduces 2 alerts when merging 13ba861 into 66a2692 - view on LGTM.com new alerts:
|
Commit 1 e84efad - introduce reloadCnf() for modules, each module capable of reloading its config should implement it. The CI failed because of the following reasons: PR contains more than 1 commit, commented out code and elasticsearch issue connection issue. Let me know if there is something I forgot to answer. |
On Wed, 26 Jan 2022, Attila Lakatos wrote:
All I wanted to accomplish in this PR, is to provide a way to dynamically reload the ```imtcp``` input module in the following manner: every single ```input(type="imtcp")``` instance, which
- is both present in old and new config is not disturbed at all
- is present in the old config but not in the new one is gracefully shut down
- is present in the new config but not in the old one will begin to run
Please note that at this point, I do not take into consideration that the ruleset can change for an imtcp input. I know it's a bit silly but I think that will require a separate PR due to its complexity.
This is a good starting point. Another very useful place to do early would be
imfile.
will your initial version work with inputs going to rulesets? existing inputs
with different rulesets? crypto changes? etc? or are you just looking at
additions/removals?
David Lang
|
This pull request introduces 2 alerts when merging 805f886 into 66a2692 - view on LGTM.com new alerts:
|
The current version works with inputs going to rulesets. When config is reloaded, new inputs will deliver logs to whatever the ruleset is configured to. It has only one drawback: when a certain input is present in both old and new configs, then the ruleset is not updated(its content might have changed). In order to make it work, some changes in the There are some globals which may affect |
sorry, I overlooked this. This sounds like we should/could use github projects. Will look into it - there is some new beta feature, but not sure if this suits us well. The "old" one is clumsy but worked so far sufficiently well. |
lol... I began to create the project this morning and was than dragged away. It's there, and I have assigned this PR to it. Pls try if you can assign your other work (else we need to look into permission settings). |
@Cropi I plan the next scheduled stable release for the 15th. do you think we should include this PR then? If so, we may need to do a little of finish-up work. Pls let me know your thoughts. |
Unfortunately, I am not able to assign a PR to the project. |
thx, I'll have a look into permission requirements |
I think this PR will need additional changes, so it would be a good idea to postpone it to a later release. |
The pull request encapsulates multiple changes, let me break it down for smaller parts:
Input threads
Name of a new input thread now consists of its name(e.g. imtcp) and its serial(e.g. 1 - in which dynamic conf reload has the thread been created). The purpose of this is to better distinguish between input threads that have been created during runtime.
Globals
New global directive is introduced - hup.reload.config. If set to "on", rsyslog will dynamically reload its configuration(right now only imtcp is implemented to do so). Otherwise, old behavior is used.
Modules
New function,
reloadCnf()
has been added to the interface. If a certain module implements it, the module will be signaled when rsyslog is HUPed, requesting the module to dynamically reload its config.The imtcp module - conf reload
imtcp
module configs we can not use old instances -> we need to reload all of them, note that not all of the module parameters force us to reload all instances, but for simplicity I think it makes sense to do it this way and later improve itIt would be a lot easier if I just closed all instances and restarted them later but in that case existing TCP connections would have been disturbed.
The idea behind this is to not touch existing TCP connections, just relocate them from the old config to the new one.
Comparing two imtcp module/instance configs
I am open to any ideas for some change here. I could not come up with a better way when comparing them, also I am not sure where to place macros used for comparing two instances/configs -- other modules will need them as well.