Ask Your Question
0

Question on module: rodjek/logrotate

asked 2015-02-22 23:08:39 -0500

gcollins gravatar image

Hello all. I have a question on this module if anyone is using it. I have a file that has multiple paths in one file I need to replicate.

  logrotate::rule {
    'cobblerd_rotate':
      path        => '/var/log/cobbler/cobbler.log',
      create_mode => '0644',
      missingok   => true,
      postrotate  => '/etc/init.d/cobblerd condrestart > /dev/null',
      ifempty     => false;
  }

Within the rule I need multiple paths so I can duplicate what I need to replace. Can anyone show me how to do this? I am so new to puppet I just need a sample to get over the hump.

Here is what file I need to duplicate looks like:

/var/log/cobbler/cobbler.log {
   missingok
   notifempty
   rotate 4
   weekly
   postrotate
      if [ -f /var/lock/subsys/cobblerd ]; then
         /etc/init.d/cobblerd condrestart > /dev/null
      fi
   endscript
}

/var/log/cobbler/tasks/*.log {
   weekly
   rotate 0
   missingok
   ifempty
   nocompress
   nocreate
   nomail
}

/var/log/cobbler/install.log {
   missingok
   notifempty
   rotate 4
   weekly
}

If you can assist, that would be great.

Thank you.

Glen

edit retag flag offensive close merge delete

Comments

Thanks! That helped very much!

gcollins gravatar imagegcollins ( 2015-04-07 11:46:23 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2015-02-24 22:31:44 -0500

GregLarkin gravatar image

From what I can see, you are on the right track with your Puppet code, and you just need to add 2 more logrotate::rule resources to implement the other 2 entries in the logrotate config file. Can you be more specific about what the exact problem is?

The rodjek-logrotate module has all of the various configuration options you need to generate the correct contents of the logrotate config file, and you can pass wildcards paths (e.g. /var/log/cobbler/tasks/*.log) to the path attribute.

As with all other Puppet resources, just make sure that each logrotate::rule resource declaration has a unique title, and you will be all set.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2015-02-22 23:08:39 -0500

Seen: 658 times

Last updated: Feb 24 '15