diff options
author | Rob Austein <sra@hactrn.net> | 2016-04-26 20:07:41 +0000 |
---|---|---|
committer | Rob Austein <sra@hactrn.net> | 2016-04-26 20:07:41 +0000 |
commit | 01697787912f143ab2b9a938e33c73c9a8a9ae0b (patch) | |
tree | 8065ac9a88d697678de0ad68c13683c6c2f5dd69 /rp | |
parent | 1447a61b235699163f186ef689ca8eaf898ee478 (diff) |
Further consolidation of config file parsing, command line parsing,
and logging setup. Most programs now use the unified mechanism,
although there are still a few holdouts: the GUI, which is a special
case because it has no command line, and the rpki-rtr program, which,
for historical reasons has its own implementation of the logging setup
infrastructure.
svn path=/branches/tk705/; revision=6390
Diffstat (limited to 'rp')
-rw-r--r-- | rp/config/rpki-confgen.xml | 227 | ||||
-rwxr-xr-x | rp/config/rpki-sql-setup | 2 | ||||
-rwxr-xr-x | rp/rcynic/rcynicng | 5 |
3 files changed, 224 insertions, 10 deletions
diff --git a/rp/config/rpki-confgen.xml b/rp/config/rpki-confgen.xml index 5f641161..b7bc2f62 100644 --- a/rp/config/rpki-confgen.xml +++ b/rp/config/rpki-confgen.xml @@ -413,6 +413,42 @@ </doc> </option> + <option name = "log-destination" + value = "file"> + <doc> + Default logging mechanism, can be "file", "syslog", "stderr", or "stdout". + </doc> + </option> + + <option name = "log-directory" + value = "/var/log/rpki"> + <doc> + Where to write log files when logging to files. + </doc> + </option> + + <option name = "log-level" + value = "info"> + <doc> + Default logging level. + </doc> + </option> + + <option name = "log-time-limit" + value = "3"> + <doc> + Interval between log file rotations, in hours. + Set to zero to disable automatic rotations. + </doc> + </option> + + <option name = "log-count" + value = "56"> + <doc> + How many old logs to keep before deleting. + </doc> + </option> + </section> <section name = "rcynic"> @@ -425,13 +461,6 @@ section. </doc> - <doc> - This section isn't really fleshed out yet, and just contains the - settings needed for the new SQL code to work. This will change - as the stuff that's currently only configurable on rcynicng's - command line becomes integrated with the configuration file. - </doc> - <option name = "sql-engine" value = "${myrpki::rcynic_sql_engine}"> <doc> @@ -460,6 +489,42 @@ </doc> </option> + <option name = "log-destination" + value = "${myrpki::log-destination}"> + <doc> + Logging mechanism, can be "file", "syslog", "stderr", or "stdout". + </doc> + </option> + + <option name = "log-filename" + value = "${myrpki::log-directory}/rcynic.log"> + <doc> + Where to write log file when logging to a file. + </doc> + </option> + + <option name = "log-level" + value = "${myrpki::log-level}"> + <doc> + Default logging level. + </doc> + </option> + + <option name = "log-time-limit" + value = "${myrpki::log-time-limit}"> + <doc> + Interval between log file rotations, in hours. + Set to zero to disable automatic rotations. + </doc> + </option> + + <option name = "log-count" + value = "${myrpki::log-count}"> + <doc> + How many old logs to keep before deleting. + </doc> + </option> + </section> <section name = "rpkid"> @@ -566,6 +631,42 @@ </doc> </option> + <option name = "log-destination" + value = "${myrpki::log-destination}"> + <doc> + Logging mechanism, can be "file", "syslog", "stderr", or "stdout". + </doc> + </option> + + <option name = "log-filename" + value = "${myrpki::log-directory}/rpkid.log"> + <doc> + Where to write log file when logging to a file. + </doc> + </option> + + <option name = "log-level" + value = "${myrpki::log-level}"> + <doc> + Default logging level. + </doc> + </option> + + <option name = "log-time-limit" + value = "${myrpki::log-time-limit}"> + <doc> + Interval between log file rotations, in hours. + Set to zero to disable automatic rotations. + </doc> + </option> + + <option name = "log-count" + value = "${myrpki::log-count}"> + <doc> + How many old logs to keep before deleting. + </doc> + </option> + </section> <section name = "irdbd"> @@ -632,6 +733,42 @@ </doc> </option> + <option name = "log-destination" + value = "${myrpki::log-destination}"> + <doc> + Logging mechanism, can be "file", "syslog", "stderr", or "stdout". + </doc> + </option> + + <option name = "log-filename" + value = "${myrpki::log-directory}/irdbd.log"> + <doc> + Where to write log file when logging to a file. + </doc> + </option> + + <option name = "log-level" + value = "${myrpki::log-level}"> + <doc> + Default logging level. + </doc> + </option> + + <option name = "log-time-limit" + value = "${myrpki::log-time-limit}"> + <doc> + Interval between log file rotations, in hours. + Set to zero to disable automatic rotations. + </doc> + </option> + + <option name = "log-count" + value = "${myrpki::log-count}"> + <doc> + How many old logs to keep before deleting. + </doc> + </option> + </section> <section name = "pubd"> @@ -764,6 +901,82 @@ </doc> </option> + <option name = "log-destination" + value = "${myrpki::log-destination}"> + <doc> + Logging mechanism, can be "file", "syslog", "stderr", or "stdout". + </doc> + </option> + + <option name = "log-filename" + value = "${myrpki::log-directory}/pubd.log"> + <doc> + Where to write log file when logging to a file. + </doc> + </option> + + <option name = "log-level" + value = "${myrpki::log-level}"> + <doc> + Default logging level. + </doc> + </option> + + <option name = "log-time-limit" + value = "${myrpki::log-time-limit}"> + <doc> + Interval between log file rotations, in hours. + Set to zero to disable automatic rotations. + </doc> + </option> + + <option name = "log-count" + value = "${myrpki::log-count}"> + <doc> + How many old logs to keep before deleting. + </doc> + </option> + + </section> + + <section name = "rpki-nanny"> + + <option name = "log-destination" + value = "${myrpki::log-destination}"> + <doc> + Logging mechanism, can be "file", "syslog", "stderr", or "stdout". + </doc> + </option> + + <option name = "log-filename" + value = "${myrpki::log-directory}/rpki-nanny.log"> + <doc> + Where to write log file when logging to a file. + </doc> + </option> + + <option name = "log-level" + value = "${myrpki::log-level}"> + <doc> + Default logging level. + </doc> + </option> + + <option name = "log-time-limit" + value = "${myrpki::log-time-limit}"> + <doc> + Interval between log file rotations, in hours. + Set to zero to disable automatic rotations. + </doc> + </option> + + <option name = "log-count" + value = "${myrpki::log-count}"> + <doc> + How many old logs to keep before deleting. + </doc> + </option> + </section> <section name = "web_portal"> diff --git a/rp/config/rpki-sql-setup b/rp/config/rpki-sql-setup index 98ef2898..6fd64588 100755 --- a/rp/config/rpki-sql-setup +++ b/rp/config/rpki-sql-setup @@ -199,7 +199,7 @@ class PostgreSQL_Driver(Abstract_Driver): pw = pwd.getpwnam(udb.username) uid = self._seteuid(pw.pw_uid) try: - self.driver.connect(database = udb.database, user = udb.username , password = usb.password).close() + self.driver.connect(database = udb.database, user = udb.username , password = udb.password).close() finally: self._seteuid(uid) diff --git a/rp/rcynic/rcynicng b/rp/rcynic/rcynicng index aee000e1..eccd247f 100755 --- a/rp/rcynic/rcynicng +++ b/rp/rcynic/rcynicng @@ -1389,7 +1389,8 @@ def main(): time.tzset() cfg = rpki.config.argparser(section = "rcynic", doc = __doc__, cfg_optional = True) - rpki.log.argparse_setup(cfg.argparser) + + cfg.add_logging_arguments() cfg.add_argument("-u", "--unauthenticated", help = "where to store unauthenticated data retrieved via rsycnc", @@ -1437,7 +1438,7 @@ def main(): global args args = cfg.argparser.parse_args() - rpki.log.init("rcynic", args) + cfg.configure_logging(args = args, ident = "rcynic") import django django.setup() |