sous-chefs / logrotate

Development repository for the logrotate cookbook

Home Page:https://supermarket.chef.io/cookbooks/logrotate

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unclear position for settings

UlrichEckhardt opened this issue · comments

We've just had some fun time debugging some issues on AWS, so please excuse any sarcasm. ;)

What happened:

We have an AWS host configured via Chef and with a custom JSON file:

    "logrotate": {
        "ourproject": {
            "path": "/var/log/ourproject/*log",
            "missingok": true,
            "dateext": true,
            "dateyesterday": true,
            "rotate": 9999,
            "frequency": "daily",
            "sharedscripts": true
        }
    }

This almost worked, it only occurred us very late that the dateext was completely ignored! Da fuq? As it turned out, dateext (and probably some more parameters) must be specified like this:

    "logrotate": {
        "ourproject": {
            "path": "/var/log/ourproject/*log",
            "options": [
                "missingok",
                "dateext",
                "dateyesterday",
                "sharedscripts"
            ],
            "rotate": 9999,
            "frequency": "daily"
        }
    }

While this structure in and of itself isn't surprising, the ugly part is that e.g. sharedscripts can appear in multiple positions. However, when I have dateext under options, then sharedscripts must appear there, too, which presents another pitfall with confusing error messages.

My wishes:

  • Provide one and only one True Way to place parameters.
  • Allow any number of less true ways for backward compatibility. Those should generate warnings when used.
  • Fail with meaningful errors when some misguided soul uses the wrong parameter. Consider that some users don't actually understand Ruby!
  • Document the meaning of DIRECTIVES and VALUES (I believe those correspond to settings with and without values). Even without knowing Ruby, I might have figured out earlier what to do then.
  • The best to you for writing and sharing this code!

Thanks for this detailed bug report. Apologies that I didn't respond to it earlier.

It appears that while the logrotate_app resource has s deprecation:

https://github.com/stevendanna/logrotate/blob/master/resources/app.rb#L112

I failed to add a similar notification to the use of the same option during "global" configuration. Overall the "global" config generation has definitely received less attention.

Marking stale due to inactivity. Remove stale label or comment or this will be closed in 7 days. Alternatively drop by the #sous-chefs channel on the Chef Community Slack and we'll be happy to help! Thanks, Sous-Chefs.

Closing due to inactivity. If this is still an issue please reopen or open another issue. Alternatively drop by the #sous-chefs channel on the Chef Community Slack and we'll be happy to help! Thanks, Sous-Chefs.