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

Feature Request - Order Matters #97

Open
thenoid opened this issue Nov 9, 2015 · 3 comments
Open

Feature Request - Order Matters #97

thenoid opened this issue Nov 9, 2015 · 3 comments

Comments

@thenoid
Copy link

thenoid commented Nov 9, 2015

Like in most things, order matters within the rsyslog.conf - it would be swell if instead of a hash for the rsyslog.default_facility_logs and rsyslog.additional_directives it was an array of hashes, so that way line order could be easily specified.

{
  "rsyslog": {
    "default_facility_logs": [
      {
        "*.info": "/var/log/firstlog"
      },
      {
        "*.info": "~"
      },
      {
        "*.err": "/var/log/orderdoesntmatter1",
        "*.debug": "/var/log/orderdoesntmatter2"
      }
    ]
  }
}

Within each array, a simple sort would/should be applied to ensure random array storage doesn't cause the file to be needlessly regenerated. So the template would end up looking like

<% node['rsyslog']['default_facility_logs'].each do |lines| %>
<% lines.sort.each do |key, value| %>
<%= key %>    <%= value %>
<% end %>
<% end %>

This would grant people to slice, push, pop, etc entries the way they wanted.

The defaults could still be implemented as hash, just the first hash in the array

  default['rsyslog']['default_facility_logs'] = [{
    '*.info;mail.none;authpriv.none;cron.none' => "#{node['rsyslog']['default_log_dir']}/messages",
    'authpriv.*' => "#{node['rsyslog']['default_log_dir']}/secure",
    'mail.*' => "-#{node['rsyslog']['default_log_dir']}/maillog",
    'cron.*' => "#{node['rsyslog']['default_log_dir']}/cron",
    '*.emerg' => ':omusrmsg:*',
    'uucp,news.crit' => "#{node['rsyslog']['default_log_dir']}/spooler",
    'local7.*' => "#{node['rsyslog']['default_log_dir']}/boot.log"
  }]
@thenoid
Copy link
Author

thenoid commented Nov 10, 2015

Could also easily implement backwards compatibility - detect if the current object is a hash, push it on to an array and save

@treenerd
Copy link

Same problem for me.
Think it would be a great idea to use array of hashes. In my case I would like to use different entries than in the default attribute files. I didn't find a way to prevent a deep merge of the default attributes. So I had do create a "hotfix". I deleted the default default_facility_logs entries in the attributes file and create new entries in the environment. Nicer would be what @thenoid suggested. +1 from my side

@eherot
Copy link
Contributor

eherot commented Feb 17, 2016

I would also vote for this, especially because of the need to sometimes precede or disable one of the default facilities. E.g. I want to be able to send all local7 logs to a different destination without having them show up in /var/log/syslog but the current system makes that a bit clunky.

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

No branches or pull requests

5 participants