Skip to content
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

Disable query logging default #128

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

ixs
Copy link

@ixs ixs commented May 3, 2019

By default, the bind formula will configure the named process to
write all queries into a query.log file which potentially is outside
the normal log-rotated dirs, thus filling up the disk.

This is rather unexpected on high traffic DNS servers.

Disable by default, can be explicity reenabled by setting enable_logging
to True.

Rework jinja logic to make enable_logging and use_extensive_logging mutually
exclusive rather than having them "stacked". It makes no sense to have the
fine-grained use_extensive_logging configuration depend on the coarse-grained
enable_logging toggle.

I am actually tempted to rename enable_logging to enable_query_log which is a
much clearer description of the functionality. Comments?
Somewhat related, log_dir is /var/log/something for every OS except Red Hat
where it is defined as /var/named/data... Any reason not to fix that
inconsistency other than the use of the chrooted functionality on Red Hat?

By default, the bind formula will configure the named process to
write all queries into a query.log file which potentially is outside
the normal log-rotated dirs, thus filling up the disk.

This is rather unexpected on high traffic DNS servers.

Disable by default, can be explicity reenabled by setting enable_logging
to True.

Rework jinja logic to make enable_logging and use_extensive_logging mutually
exclusive rather than having them "stacked". It makes no sense to have the
fine-grained use_extensive_logging configuration depend on the coarse-grained
enable_logging toggle.

I am actually tempted to rename enable_logging to enable_query_log which is a
much clearer description of the functionality. Comments?
Somewhat related, log_dir is /var/log/something for every OS except Red Hat
where it is defined as /var/named/data... Any reason not to fix that
inconsistency other than the use of the chrooted functionality on Red Hat?
@javierbertoli
Copy link
Member

I like the approach you took, it LGTM 👍

rename enable_logging to enable_query_log
My only concern is backward compatibility, which we're trying to respect lately in the formulas. I'd say one possibility would be to

  1. add a new parameter enable_query_log which effectively controls the query logging (what you propose)
  2. if the old parameter enable_logging is set:
    2.a. set enable_query_log to the value on enable_logging (for backward compatibility)
    2.b. trigger a deprecation warning message for the parameter enable_logging

Perhaps this can be done in another PR

ixs added 2 commits May 4, 2019 01:20
logging_config was only defined for Debian and xBSD resulting in
rendering errors on other OS families.

This commit fixes saltstack-formulas#115
Add a deprecation message if enable_logging is used instead of enable_query_log.
Abort if both enable_logging/enable_query_log is enabled with use_extensive_logging
as these are mutually exclusive now.

Fixup tests to _not_ look for the querylog line.
@ixs ixs force-pushed the no_default_querylog branch from 7e2652a to 1ce4378 Compare May 4, 2019 00:03
@ixs
Copy link
Author

ixs commented May 4, 2019

@javierbertoli Did that. As there's no pillar.set (contrary to grains.set) I did a bit of a workaround.

Have a look, should be passing checks now as well.

@ixs
Copy link
Author

ixs commented May 8, 2019

@javierbertoli ping?

@@ -147,7 +147,7 @@
# Match 100.51.198 reverse zone from pillar
its('content') { should match /^zone\ "100\.51\.198\.in-addr\.arpa"\ {\n\ \ type\ master;\n\ \ file\ "#{zones_directory}\/100\.51\.198\.in-addr\.arpa";\n\ \ \n\ \ notify\ no;\n\};/ }
# Match logging
its('content') { should match /^logging\ \{\n\ \ channel\ "querylog"\ {\n\ \ \ \ file\ "#{log_directory}\/query\.log";\n\ \ \ \ print-time\ yes;\n\ \ \};\n\ \ category\ queries\ \{\ querylog;\ \};\n\};/ }
its('content') { should_not match /^logging\ \{\n\ \ channel\ "querylog"\ {\n\ \ \ \ file\ "#{log_directory}\/query\.log";\n\ \ \ \ print-time\ yes;\n\ \ \};\n\ \ category\ queries\ \{\ querylog;\ \};\n\};/ }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As you're moving the logging config to another file, can you either add some tests to make sure the logging_config file/s are created properly, or open an issue so we don't forget to add tests for this? Perhaps I can find some time to add them

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay. Let me rework this a bit...

@n-rodriguez
Copy link
Member

Hi there! Any news?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants