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

update nextcloud.nix to change log type #141018

Closed
wants to merge 4 commits into from
Closed

Conversation

nivadis
Copy link
Contributor

@nivadis nivadis commented Oct 8, 2021

enable ability to change logtype for nextcloud

Motivation for this change
Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • 21.11 Release Notes (or backporting 21.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

enable ability to change logtype for nextcloud
@@ -84,6 +84,11 @@ in {
default = 2;
description = "Log level value between 0 (DEBUG) and 4 (FATAL).";
};
logType = mkOption {
type = types.str;
Copy link
Member

Choose a reason for hiding this comment

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

Please use types.enum with all possible options.

logType = mkOption {
type = types.str;
default = "syslog";
description = "log driver used, could be errorlog, file, syslog or systemd";
Copy link
Member

Choose a reason for hiding this comment

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

First character of a sentence is upper, also please terminate the sentence with a ..

Copy link
Member

Choose a reason for hiding this comment

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

Also, what's the behavior of nextcloud if file is used?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

for file: (https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/logging_configuration.html#file)
By default, a log file named nextcloud.log will be created in the directory which has been configured by the datadirectory parameter in config/config.php

change to enum
@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/nextcloud-logging-is-forcibly-configured-to-syslog/8648/3

@dschrempf
Copy link
Contributor

Some questions:

If logging type is systemd, php-systemd needs to be present on the system. Is this the case? Or do we have to take care of that too?

If logging type is file, we should probably also add an option to cover the file name, i.e., "logfile" => "nextcloud.log".

@nivadis
Copy link
Contributor Author

nivadis commented Nov 11, 2021

logfile parameter covered,
i don't know how to clarify php-systemd is preset, would be happy if one of you could add it.

Copy link
Member

@Ma27 Ma27 left a comment

Choose a reason for hiding this comment

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

If logging type is systemd, php-systemd needs to be present on the system. Is this the case? Or do we have to take care of that too?

Hmm, have you checked if syslog is sufficient? IIRC that's sufficient to write to a journal, but I may be wrong.

description = "Log driver used for nextcloud logging. Possible options: errorlog, file, syslog or systemd (see https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/logging_configuration.html).";
};
logFile = mkOption {
type = types.str;
Copy link
Member

Choose a reason for hiding this comment

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

I'd prefer to make this types.nullOr types.str and set it to null by default.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

agree, change it as you like, you know the best practices ;-)

Copy link
Contributor

Choose a reason for hiding this comment

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

If we set this to null by default, we also have to amend the strings below ${optionalString ...}.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm open to everything and would be glad if this could be solved soon, because everything is an improvement 😉

@dschrempf
Copy link
Contributor

Another question (not sure if this fits here, but no idea where to ask). Do you think we could add an extraConfig attribute? For example, on my private Nextcloud instance, I use 'localstorage.allowsymlinks' => true, and I had to add it manually to config.php.

description = "Log driver used for nextcloud logging. Possible options: errorlog, file, syslog or systemd (see https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/logging_configuration.html).";
};
logFile = mkOption {
type = types.str;
Copy link
Contributor

Choose a reason for hiding this comment

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

If we set this to null by default, we also have to amend the strings below ${optionalString ...}.

@nivadis
Copy link
Contributor Author

nivadis commented Jan 14, 2022

Would love to see this soon upstream, so whats needed to get an approvement?

@Ma27
Copy link
Member

Ma27 commented Jan 15, 2022

Would love to see this soon upstream, so whats needed to get an approvement?

The logFile option should be null by default IMHO.

'log_type' => 'syslog',
'log_level' => '${builtins.toString cfg.logLevel}',
'log_type' => '${cfg.logType}',
${optionalString cfg.logFile "'logfile' => '${cfg.logFile}',"}
Copy link
Member

Choose a reason for hiding this comment

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

This doesn't evaluate, in any case:

error: value is a string while a Boolean was expected

with logFile being declared and

error: value is null while a Boolean was expected

Please fix this accordingly and test the changes e.g. using a VM test (you can perform a single run via e.g. nix-build nixos/tests/nextcloud -A basic23).

Also, please make sure that your commit messages adhere to our contribution guidelines.

Copy link
Member

Choose a reason for hiding this comment

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

The current change doesn't evaluate. As long as that's still the case, this cannot be merged.

Copy link
Contributor Author

@nivadis nivadis left a comment

Choose a reason for hiding this comment

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

oh, sorry.

@dschrempf
Copy link
Contributor

Hi! Is there anything I can do at the moment? It seems this PR is stuck a little bit. As far as I can see, the only thing left is to set the log file to null by default. This change involves some other small fixes, but I think all of them are covered in the reviews. What do you think @nivadis? Would you rather not set log file to null?

@nivadis
Copy link
Contributor Author

nivadis commented Feb 2, 2022

hey,
sounds good to me. i'm not super familiar with this process, the log file is set to nullisn't it?
i agree to the changes requested, but see no merge option here.

@Ma27
Copy link
Member

Ma27 commented Jun 17, 2022

After revisiting this I think that in 99% it's preferable to have the logs written to journald. Additional things that aren't super-common should be implemented via #118093.

@Ma27 Ma27 closed this Jun 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants