cname host is logged twice #53

Closed
opened 2021-11-20 11:25:14 +00:00 by ungleich-gitea · 9 comments
ander@limukas:~$ grep verbosity .cdist.cfg 
verbosity = INFO
ander@limukas:~$ cdist config cname.example.com
INFO: [272690]: cname.example.com: Starting configuration run
INFO: cname.example.com: Starting configuration run
INFO: [272690]: cname.example.com: Finished successful run in 23.65 seconds
INFO: cname.example.com: Finished successful run in 23.65 seconds
ander@limukas:~$ cdist config 127.0.0.1
INFO: [273185]: 127.0.0.1: Starting configuration run
INFO: [273185]: 127.0.0.1: Finished successful run in 23.87 seconds

only happens with addresses which are cnames. @poljakowski?

``` ander@limukas:~$ grep verbosity .cdist.cfg verbosity = INFO ander@limukas:~$ cdist config cname.example.com INFO: [272690]: cname.example.com: Starting configuration run INFO: cname.example.com: Starting configuration run INFO: [272690]: cname.example.com: Finished successful run in 23.65 seconds INFO: cname.example.com: Finished successful run in 23.65 seconds ander@limukas:~$ cdist config 127.0.0.1 INFO: [273185]: 127.0.0.1: Starting configuration run INFO: [273185]: 127.0.0.1: Finished successful run in 23.87 seconds ``` only happens with addresses which are cnames. @poljakowski?
poljakowski was assigned by ungleich-gitea 2021-11-20 11:25:14 +00:00
Author
Owner

mentioned in commit 06cc20aa28

mentioned in commit 06cc20aa28a3cdfc09dd5642fb66e1b24a8e8d2b
Author
Owner

closed via merge request !883

closed via merge request !883
Author
Owner

good work! thanks!

good work! thanks!
Author
Owner

mentioned in merge request !883

mentioned in merge request !883
Author
Owner

mentioned in commit f4e1bbc87e

mentioned in commit f4e1bbc87e9127ed4ac1789c700e1cbee02ff61c
Author
Owner

@ander Figured it out :) This has nothing to do with CNAME, but with cdist. as first part of hostname.

It's about logger hierarchy which is defined by dots in logger name.

https://docs.python.org/3/library/logging.html#module-logging

The name is potentially a period-separated hierarchical value, like foo.bar.baz (though it could also be just plain foo, for example). Loggers that are further down in the hierarchical list are children of loggers higher up in the list.

So we have cdist logger, created before target host processing.
Then we process host cdist.whatever. Logging creates logger hierarchy, which means cdist logger is parent of .whatever. When cdist.whatever logs something, this is also propagated to ancestors.
There is one ancestor defined, cdist logger, so it too writes log message.
That is why all are written twice.
For parallel part, cdist ancestor is defined without process ID in its format, so you have one line with process ID, and one line without it.

Since we don't use hierarchy with propagation in its full potential, I will try fixing this bug with setting propagate to False.

@ander Figured it out :) This has nothing to do with `CNAME`, but with `cdist.` as first part of hostname. It's about logger hierarchy which is defined by dots in logger name. https://docs.python.org/3/library/logging.html#module-logging > The name is potentially a period-separated hierarchical value, like foo.bar.baz (though it could also be just plain foo, for example). Loggers that are further down in the hierarchical list are children of loggers higher up in the list. So we have `cdist` logger, created before target host processing. Then we process host `cdist.whatever`. Logging creates logger hierarchy, which means `cdist` logger is parent of `.whatever`. When `cdist.whatever` logs something, this is also propagated to ancestors. There is one ancestor defined, `cdist` logger, so it too writes log message. That is why all are written twice. For parallel part, `cdist` ancestor is defined without process ID in its format, so you have one line with process ID, and one line without it. Since we don't use hierarchy with propagation in its full potential, I will try fixing this bug with setting `propagate` to `False`.
Author
Owner

cnameconfig.log

If you give me your id.pub, I can give you access for testing.

[cnameconfig.log](/uploads/c68460a24638ebdbb62ed66b74c8645d/cnameconfig.log) If you give me your `id.pub`, I can give you access for testing.
Author
Owner

@ander Do you have a trace log level output for cname case?

@ander Do you have a trace log level output for cname case?
Author
Owner

assigned to @poljakowski

assigned to @poljakowski
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: ungleich-public/cdist#53
No description provided.