You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
cleanup-tools/acc-cleanup.conf

132 lines
4.8 KiB

# ngcp-cleanup-acc configuration file
#
############
#
# This is a script style config file. The config consists of a series of
# statements, one per line, which are going to be executed in sequence.
# A statement can either just set a variable to some value, or perform an
# action. The behavior of action statement may be influenced by the value
# of certain variables. Variables retain their value until they're set to
# something else.
#
# Comments will only be recognized as such if the "#" character is the first
# character of the line.
#
# Variables can be set with a statement like this:
# variable = value
# For example, to set the variable called "foo" to the value "bar":
# foo = bar
# Leading and trailing whitespace are removed for both variable name and
# value.
#
# Variables have no default value. If an action statement requires a certain
# variable to be set and it isn't, then the script will exit with an error.
# Variables can be unset with the "unset" statement:
# unset foo
#
# If the script encounters an error at any point, it will stop executing the
# config and return an error.
#
############
#
# Connect to a database:
# connect <database name>
# This statement will use the variables "host", "username" and "password" to
# connect to the database, all of which are optional as per the DBI
# specification.
# The database connection remains active up to the next "connect" statement.
#
# "use-partitioning": If a table supports partitioning and the value is set
# to "yes", then it is partitioned using the time-column or the timestamp
# column, otherwise the usually (and slow) method is used to delete/move
# data by chunks.
#
# Create monthly backup tables:
# backup <table name>
# Moves old records out of the specified table and sorts them into monthly
# tables, which will be created as necessary using the same table name and a
# suffix of _YYYYMM.
# The following variables are used:
# "time-column": The name of the column in the table to use for determining
# which month a record belong to. Must be a "datetime" column.
# "timestamp-column": The name of the column in the table to use for determining
# which month a record belong to. Must be a "decimal(13,3)" column.
# "batch": How many records to process within a single statement. If unset or
# <= 0, it does them all at once.
# "keep-months": How many months worth of records to keep in the table and
# not move into the monthly backup tables. Months are always processed as a
# whole and this specifies how many months to keep AT MOST. In other words,
# if the script is started on December 15th and this value is set to "2", then
# all of December and November is kept, and all of October will be backed up.
#
# Archiving (dumping) old monthly backup tables:
# archive <table name>
# Create an SQL dump out of too old tables created by the "backup" statement
# and drop them afterwards. Uses the following variables:
# "archive-months": Uses the same logic as the "keep-months" variable above.
# If set to "12" and the script was started on December 15th, it will start
# archiving with the December table of the previous year. Archiving continues
# month by month, going backwards in time, until the script encounters a
# missing table.
# "archive-target": Target directory for writing the SQL dump files. If
# explicitly specified as "/dev/null", then no actual archiving will be
# performed, but instead the tables will only be dropped.
# "compress": If set to "gzip", then gzip the dump files after creation. If
# unset, do not compress.
# "host", "username" and "password": As dumping is performed by an external
# command, those variables are reused from the "connect" statement.
#
# Cleaning up tables without backup:
# cleanup <table name>
# Works just like the "backup" statement, but doesn't actually backup
# anything, but rather just deletes old records. Variables used:
# "time-column": See above.
# "batch": See above.
# "cleanup-days": Deleting everything older than this many days.
#
############
debug = 1
batch = 10000
archive-target = /tmp
compress = gzip
username = root
password = 1freibier!
### Example use cases
# No collector running, clean up old acc entries from kamailio db:
#
# connect kamailio
# time-column = time
# cleanup-days = 90
# cleanup acc
# Clean up after mediator by deleting old leftover acc entries and deleting
# old entries out of acc_trash and acc_backup
#
# # with collector:
# connect accounting
# # without collector:
# connect kamailio
#
# time-column = time
# cleanup-days = 30
# cleanup acc
# cleanup-days = 180
# cleanup acc_trash
# cleanup acc_backup
# Create monthly backup tables for CDRs older than 6 months. Dump monthly
# backup tables older than a year to /backup.
#
# connect accounting
# time-column = start_time
# keep-months = 7
# backup cdr
# archive-months = 13
# archive-target = /backup
# archive cdr