/
15-logging.rc
70 lines (56 loc) · 3.29 KB
/
15-logging.rc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# ! FILE IS CONTROLLED BY ANSIBLE, DO NOT CHANGE, OR ELSE YOUR CHANGES WILL BE EVENTUALLY LOST !
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# vim: ft=dosini
# Log Rotation, Archival, and Pruning
# -----------------------------------
# Note that the "main" log is only rotated when using rTorrent-PS 1.1+ (after 2017-03-26),
# since 'log.open_file' needed to learn how to re-open first. Otherwise, you will get a daily
# console warning.
# Settings for archival delay, and retention [days]
method.insert.value = pyro.log_retention.days, 7
method.insert.value = pyro.log_archival.days, 2
# Create HUGE xmlrpc log files?
method.insert.value = pyro.log.xmlrpc.enabled, 0
method.insert = pyro._log.xmlrpc.closing, const|private|simple, \
"if = (system.has, fixed-log-xmlrpc-close), (cat,), (cat, /dev/null)"
# Create a "YYYY-mm-dd-HHMMSS" time stamp
method.insert = pyro.date_iso.log_stamp, simple|private,\
"execute.capture_nothrow = bash, -c, \"echo -n $(date +%Y-%m-%d-%H%M%S)\""
# String value for the currently used time stamp, changed on rotation
method.insert = pyro.log_stamp.current, string
# Create a full logfile path using the current stamp
method.insert = pyro.logfile_path, simple|private,\
"cat = (cfg.logs), (argument.0), \"-\", (pyro.log_stamp.current), .log"
# (Re-)open all logs with a current time stamp; the main log file
# is just opened, you need to add some logging scopes yourself!
method.insert = pyro.log_rotate, multi|rlookup|static
method.set_key = pyro.log_rotate, !stamp,\
"pyro.log_stamp.current.set = (cat, (pyro.date_iso.log_stamp))"
method.set_key = pyro.log_rotate, execute,\
"log.execute = (pyro.logfile_path, execute)"
method.set_key = pyro.log_rotate, messages,\
"branch = (pyro.extended), ((log.messages, (pyro.logfile_path, messages) ))"
method.set_key = pyro.log_rotate, xmlrpc,\
"branch = pyro.log.xmlrpc.enabled=, \"log.xmlrpc=(pyro.logfile_path, xmlrpc)\", \
\"log.xmlrpc=(pyro._log.xmlrpc.closing)\""
method.set_key = pyro.log_rotate, ~main,\
"log.open_file = log, (pyro.logfile_path, rtorrent)"
# Logrotate schedule (rotating shortly after 1AM, so DST shenanigans
# are taken care of, and rotation is always near the begin of the next day)
schedule2 = pyro_daily_log_rotate, 01:05:00, 24:00:00, ((pyro.log_rotate))
# Log file archival and pruning
method.insert = pmb._logfile_find_cmd, simple|private,\
"cat = \"find \", (cfg.logs),\
\" -daystart -type f -name '*.\", (argument.0),\"'\",\
\" -mtime +\", (argument.1),\
\" -exec nice \", (argument.2), \" '{}' ';'\""
schedule2 = pyro_logfile_archival, 01:10:00, 24:00:00,\
"execute.nothrow = bash, -c, (pmb._logfile_find_cmd, log, (pyro.log_archival.days), gzip)"
schedule2 = pyro_logfile_pruning, 01:20:00, 24:00:00,\
"execute.nothrow = bash, -c, (pmb._logfile_find_cmd, log.gz, (pyro.log_retention.days), rm)"
# Open logs initially on startup
pyro.log_rotate=
schedule2 = pyro_startup_log_xmlrpc_open, 7, 0, \
"branch = pyro.log.xmlrpc.enabled=, \"log.xmlrpc=(pyro.logfile_path, xmlrpc)\""
# END logging