# YAML

paths:

##
# Location of the state file (database about log rotation).
#
# Default value:
#   /var/lib/rb.rotate.status
#

state file: /var/lib/rb.rotate.status

## 
# Contains location of the file with default values. Content of this
# file is merged with this file. You sholdn't need edit it.
#
# Default value:
#   %%configuration/defaults.yaml
#

defaults file: %%configuration/defaults.yaml

##
# Contains path to log file.
#
# Default value:
#   /var/log/rb.rotate.log
#

log file: /var/log/rb.rotate.log

hooks:

# something: /path/to/some/script %filepath

dirs:

##
# Default directory must be set.
#

default:

    ##
    # Directory from which will be logs archived. Recursive 
    # parameter says if it will be performed in subdirs.
    #
    # Default value:
    #   /var/log
    #

    directory: /var/log

    ##
    # Defines inheritance. Options missing in the directory settings
    # are then inherited from the parent directory.
    #
    # Default value:
    #   nothing
    #

    #parent: 

    ##
    # Says if archiving will be performed in subdirs of the 
    # 'directory' too. It's boolean value, but third value is 'flat'
    # which means, files from subdirs will be archived without 
    # respecting the old structure directly to the 'archive' 
    # directory. In otherwise, original subdirectory structure will 
    # be respected.
    #
    # Possible values:
    #   - yes
    #   - no
    #   - flat
    #
    # Default value:
    #   yes
    #

    recursive: yes

    ##
    # Says, it should follow symbolic links by transparent way. In 
    # storage, they will be handled as normal files and dirs. If 
    # false, they will be silently ignored.
    #
    # Default value:
    #   yes
    #

    follow: yes

    ##
    # Directory to which will be logs archived.
    #
    # Default value:
    #   /var/log/archive
    #   

    storage: /var/log/archive

    ##
    # Says which command use for compressing the log. It must 
    # support the same base syntax and '<command> <file>' order
    # as gzip and bzip2. You can specify it both as path with 
    # parameters or simply shell command. Uses gzip --best as 
    # default if set to 'yes'.
    #
    # It's also necessary specify the extension because without it
    # rotate cannot detect compressed filenames. If you change 
    # compression method, all archived logs will be recompressed 
    # during next rotation.
    #
    # Default value:
    #   no
    #
    # Possible values:
    #   [<command>, <extension>]
    #   yes
    #   no
    #

    compress: yes

    ##
    # Says which command use for decompression. It expects the same 
    # base syntax as gunzip or bunzip2. Uses gunzip as default if 
    # set to 'yes'.
    #
    # Be warn, decompress option must be synchronized with the 
    # compress option. Logically, if you set rotate up for 
    # compressing the logs, you must temporarily decompress them in 
    # archive before appending content to them or mailing them.
    # If you turn off the compressing without decompressing enabled,
    # it will cause damaged archive, of sure.
    #
    # Default value:
    #   no
    #
    # Possible values:
    #   <command>
    #   yes
    #   no
    #

    decompress: yes

    ##
    # Says logs from which period it will keep accroding to 'type' 
    # option. So for example rotate settings '5' of the type 
    # 'weekly' means it will keep logs from five weeks.
    # 
    # Default value:
    #   5
    #

    rotate: 5

    ##
    # Says how old should be log for archiving and in combination
    # with 'rotate' option how old should be logs in archive 
    # maximally. (Simply period * rotate.)
    #
    # In contrast to classical logrotate, you can enter wide range
    # of values. Firstly 'yearly', 'monthly' etc. where are their
    # sense probably clear and secondly in format:
    #   <number> <period>
    #
    # So for example '2 weeks' or '5 days'. The smallest interval
    # in this format is second, so you can define for example little 
    # obscure setting '2 seconds' or so.
    #
    # Be warn, if you will really use seconds with combination of
    # date identifier of the archived files, default identifier 
    # format includes minutes only, so without changing it there is 
    # danger of rewritting the archived files.
    #
    # Default value:
    #   weekly
    #
    # Possible values:
    #   - yearly
    #   - monthly 
    #   - weekly
    #   - daily 
    #   - hourly
    #   - <number> years
    #   - <number> months
    #   - <number> weeks
    #   - <number> days
    #   - <number> hours
    #   - <number> minutes
    #   - <number> seconds
    #

    period: weekly

    ##
    # Guards maximal size of the log. Log is bigger than this value,
    # rotates it. But it keeps other archived logs lifetime, so 
    # although log has been rotated prematurely and number of logs 
    # in archive is bigger then 'rotate' settings, it will keep all 
    # because 'rotate' settings means only number of 'type' units 
    # for keeping the log, nothing more.
    #
    # You can use base units here: 'K', 'M' and 'G' which mean 
    # appropriate quantity of kilobytes, megabytes and gigabytes.
    #
    # Default value:
    #   20M
    #

    max size: 20M

    ##
    # Says to which e-mail address send recycled log or eventually
    # the undefined mail action result.
    #
    # Default value:
    #   nothig
    #

    mail: root@localhost

    ##
    # Says how to recycle mail removed from archive. It can be 
    # removed or removed and mailed to mail specified in 'mail' 
    # option. If 'no' or 'keep' option set, old archived logs are 
    # kept forever.
    #
    # Default value:
    #   remove
    #
    # Possible values:
    #   remove
    #   mail
    #   keep
    #   no
    #

    recycle: remove

    ##
    # Says which type of archive distinguisher rotate will use.
    # You can state the 'numeric' identifier, then increasing number
    # will be used, or specify the string in date format syntax.
    #
    # Date formatting directives are following:
    #
    #   %a - The abbreviated weekday name (``Sun'')
    #   %A - The  full  weekday  name (``Sunday'')
    #   %b - The abbreviated month name (``Jan'')
    #   %B - The  full  month  name (``January'')
    #   %c - The preferred local date and time representation
    #   %d - Day of the month (01..31)
    #   %H - Hour of the day, 24-hour clock (00..23)
    #   %I - Hour of the day, 12-hour clock (01..12)
    #   %j - Day of the year (001..366)
    #   %m - Month of the year (01..12)
    #   %M - Minute of the hour (00..59)
    #   %p - Meridian indicator (``AM''  or  ``PM'')
    #   %S - Second of the minute (00..60)
    #   %U - Week  number  of the current year, starting with the 
    #        first Sunday as the first day of the first week (00..53)
    #   %W - Week  number  of the current year, starting with the 
    #        first Monday as the first day of the first week (00..53)
    #   %w - Day of the week (Sunday is 0, 0..6)
    #   %x - Preferred representation for the date alone, no time
    #   %X - Preferred representation for the time alone, no date
    #   %y - Year without a century (00..99)
    #   %Y - Year with century
    #   %Z - Time zone name
    #   %% - Literal ``%'' character    
    #
    # If you type simply 'date', the following format will be used:
    #   %Y%m%d.%H%M
    #
    # Generally are supported all directives as listed in:
    #   http://ruby-doc.org/core/classes/Time.html#M000298
    # 
    # Default value:
    #   numeric
    #
    # Possible values:
    #   numeric
    #   date
    #   <some formatting string>
    #

    identifier: numeric

    ##
    # Says by which actions archive. Some daemons keep logs open, so 
    # there is necessary to copy the old log and truncate the file.
    #
    # One additional option is 'append' which orders appending the 
    # log to existing file. It has sense, of sure, only if the 
    # 'identifier' option is set by appropriate way, so filename in
    # archive storage is static. Be warn, if you use compression, 
    # file will be recompressed in the whole if this action applied.
    #
    # 'Mail' action will mail log to specified address. If its
    # argument is omitted, it will use argument from 'mail' setting.
    #
    # Be warn, this option works by "programmable" way. Tokens are 
    # evaluated in the order and without thinking about the right sense.
    # So for example 'copy + move' will cause error because of moving 
    # the log to the existing file from previous copying, or 
    # 'truncate + copy' will truncate the file and thereafter copy empty
    # file to archive location which probably isn't the required 
    # behaviour.
    #
    # It's possible to create chains, it isn't limited by number of two
    # operations. Multiline can be achieved by standard YAML syntax.
    # Chains are very useful for hooks.
    #
    # HOOKS
    #
    # But you can use hooks. Hook will get path to the file 
    # generated by preceding built-in operation as parameter 
    # %filepath, so it will get for example path to new file in 
    # archive in case of 'copy' or 'move' or name of the old file 
    # after 'truncate' or 'create'. Hook placed just after 
    # another hook will get parameters defined by YAML encoded 
    # hash array.
    #
    # Parameters are kept through the chain of actions, they are 
    # only overwritten by each action, so if action one will generate
    # some argument and preceding action has generated another two
    # arguments, these two arguments will be available for hooks
    # after the action one too and the third argument will be 
    # available with new value set by action one.
    #
    #
    # Possible values:
    #   - move
    #   - append
    #   - create
    #   - remove
    #   - truncate
    #   - mail:<e-mail>
    #   - hook:<hook name>
    #
    # Default value:
    #   move + create
    #

    action: move + create