]> git.ipfire.org Git - thirdparty/FORT-validator.git/commitdiff
Add docs for log level and output, remove DEBUG flag at Makefile
authorpcarana <pc.moreno2099@gmail.com>
Wed, 16 Oct 2019 18:29:22 +0000 (13:29 -0500)
committerpcarana <pc.moreno2099@gmail.com>
Thu, 7 Nov 2019 16:47:40 +0000 (10:47 -0600)
docs/logging.md
docs/usage.md
man/fort.8
src/Makefile.am

index 87670d5b38eada68e3bf7c02c81a4b915cc59403..a3c98ad55bd5b7f3c99b2a8c49547f47cc1d97ca 100644 (file)
@@ -1,24 +1,55 @@
 ---
 title: Logging
+url-log-level: "[`--log.level`](usage.html#--loglevel)"
+url-log-output: "[`--log.output`](usage.html#--logoutput)"
+url-log-color-output: "[`--log.color-output`](usage.html#--logcolor-output)"
+url-log-file-name-format: "[`--log.file-name-format`](usage.html#--logfile-name-format)"
 ---
 
 # {{ page.title }}
 
-- If Fort is run in [server mode](usage.html#--mode), all logging is sent to syslog.
-- If Fort is run in standalone mode, informational messages are printed in standard output and error messages are thrown to standard error.
+FORT validator logging can be configured using the arguments:
+- {{ page.url-log-level }}
+- {{ page.url-log-output }}
+- {{ page.url-log-color-output }}
+- {{ page.url-log-file-name-format }}
 
-During the brief period in which configuration has not been completely parsed yet (and therefore, Fort is not yet aware of the desired running mode), the standard streams and syslog are used simultaneously.
+## Log output
 
-Fort uses exactly five syslog levels of priority. These are their meanings:
+During the brief period in which configuration has not been completely parsed yet (and therefore, the validator is not yet aware of the desired log output), the standard streams and syslog are used simultaneously.
 
+Once the configuration has been loaded, all the log messages will be printed at the configured {{ page.url-log-output }}, which can have two values:
+- `syslog`: all logging is sent to syslog.
+- `console`: informational and debug messages are printed in standard output, error and critical messages are thrown to standard error.
+
+> Syslog configuration and usage is out of this docs scope, here's a brief introduction from [Wikipedia](https://en.wikipedia.org/wiki/Syslog). You can do some research according to your prefered OS distro to familiarize with syslog, since distinct implementations exists (the most common are: syslog, rsyslog, and syslog-ng).
+
+## Log level
+
+The {{ page.url-log-level }} argument defines which messages will be logged according to its priority. Any log message of equal or higher importance to the one configured, will be logged, e.g. a value of `info` will log messages of equal or higher level (`info`, `warning`, and `error`).
+
+The validator uses exactly five levels of priority (they're just some of all the syslog priority levels), but only four of them can be utilized in {{ page.url-log-output }}. These are their meanings and priority from highest to lowest:
 - `crit`: Programming errors. (These lead to program termination.)
-- `err`: Validation failures. (RPKI object rejected.)
+       - **This level can't be indicated at {{ page.url-log-level }}**, since `error` and `crit` messages are relevant for an adequate operation.
+- `error`: Validation failures. (RPKI object rejected.)
 - `warning`: Suspicious validation outcome. (RPKI object not rejected.)
 - `info`: Information deemed useful to the user:
        - Configuration echo at the beginning.
        - Server binding status.
-       - Additional noise we're considering downgrading to `debug`.
-- `debug`: Information deemed useful to the developer. These messages are usually compiled out of the binary by default. If you want them, you need to enable `-DDEBUG` (eg. by uncommenting [`CFLAGS_DEBUG`](https://github.com/NICMx/FORT-validator/blob/master/src/Makefile.am#L3)).
+       - Start and end of a validation cycle, including: number of valid ROAs and Router Keys, current serial number (only when [`--mode=server`](usage.html#--mode), and real execution time.
+       - SLURM version applied in case of a syntax error or invalid data at the newest loaded SLURM configured at [`--slurm`](usage.html#--slurm).
+       - RTR client connection accepted, closed or terminated.
+- `debug`: Information deemed useful to the developer. Expect a lot of messages when utilized.
+
+## Log color output
+
+The flag {{ page.url-log-color-output }} is only meaningful when {{ page.url-log-output }} is `console` (it doesn't affect to `syslog`). When the flag is enabled, the log messages will have the following colors according to its priority:
+- `crit`: <span style="color:magenta">CYAN</span>
+- `error`: <span style="color:red">RED</span>
+- `warning`: <span style="color:orange">ORANGE</span>
+- `info`: <span style="color:lightgray">LIGHT GRAY</span>
+- `debug`: <span style="color:cyan">CYAN</span>
 
-When standard streams are enabled, `info` and `debug` are printed in standard output, while rest are printed in standard error.
+## Log file name format
 
+The flag {{ page.url-log-file-name-format }} defines how the file names will be printed at the logs output, see more details at [Program Arguments > Arguments > --log.file-name-format](usage.html#--logfile-name-format).
\ No newline at end of file
index 98f3365d65ad04c41fe703bd4a20fbae07b28a9a..0dd65ff6a36d780f0847704b042ed57e8b42544e 100644 (file)
@@ -30,15 +30,17 @@ command: fort
        15. [`--server.interval.retry`](#--serverintervalretry)
        16. [`--server.interval.expire`](#--serverintervalexpire)
        17. [`--slurm`](#--slurm)
-       18. [`--log.color-output`](#--logcolor-output)
-       19. [`--log.file-name-format`](#--logfile-name-format)
-       20. [`--output.roa`](#--outputroa)
-       21. [`--output.bgpsec`](#--outputbgpsec)
-       22. [`--configuration-file`](#--configuration-file)
-       23. [`rsync.program`](#rsyncprogram)
-       24. [`rsync.arguments-recursive`](#rsyncarguments-recursive)
-       25. [`rsync.arguments-flat`](#rsyncarguments-flat)
-       26. [`incidences`](#incidences)
+       18. [`--log.level`](#--loglevel)
+       19. [`--log.output`](#--logoutput)
+       20. [`--log.color-output`](#--logcolor-output)
+       21. [`--log.file-name-format`](#--logfile-name-format)
+       22. [`--output.roa`](#--outputroa)
+       23. [`--output.bgpsec`](#--outputbgpsec)
+       24. [`--configuration-file`](#--configuration-file)
+       25. [`rsync.program`](#rsyncprogram)
+       26. [`rsync.arguments-recursive`](#rsyncarguments-recursive)
+       27. [`rsync.arguments-flat`](#rsyncarguments-flat)
+       28. [`incidences`](#incidences)
 
 ## Syntax
 
@@ -62,6 +64,8 @@ command: fort
         [--server.interval.retry=<unsigned integer>]
         [--server.interval.expire=<unsigned integer>]
         [--slurm=<file>|<directory>]
+        [--log.level=error|warning|info|debug]
+        [--log.output=syslog|console]
         [--log.color-output]
         [--log.file-name-format=global-url|local-path|file-name]
         [--output.roa=<file>]
@@ -357,6 +361,34 @@ This value is utilized only on RTR version 1 sessions (more information at [RFC
 
 SLURM file, or directory containing SLURM files. See [SLURM](slurm.html).
 
+### `--log.level`
+
+- **Type:** Enumeration (`error`, `warning`, `info`, `debug`)
+- **Availability:** `argv` and JSON
+- **Default:** `warning`
+
+Defines which messages will be logged according to its priority, e.g. a value of `info` will log messages of equal or higher level (`info`, `warning`, and `error`).
+
+The priority levels, from higher to lowest, are:
+- `error`
+- `warning`
+- `info`
+- `debug`
+
+Read more at [Logging > Log level](logging.html#log-level).
+
+### `--log.output`
+
+- **Type:** Enumeration (`syslog`, `console`)
+- **Availability:** `argv` and JSON
+- **Default:** `console`
+
+Desired output where the logs will be printed.
+
+The value `console` will log messages at standard output and standard error; `syslog` will log to [Syslog](https://en.wikipedia.org/wiki/Syslog).
+
+Read more at [Logging > Log output](logging.html#log-output).
+
 ### `--log.color-output`
 
 - **Type:** None
@@ -372,7 +404,7 @@ If enabled, the logging output will contain ANSI color codes. Meant for human co
 <span style="color:magenta">CRT: Programming error: Array size is 1 but array is NULL.</span>
 </code></pre>
 
-At present, this flag only affects standard output and standard error. Color codes are not sent to syslog, regardless of this flag.
+At present, this flag only affects if [`--log.output`](#--logoutput) is `console`. Color codes are not sent to `syslog`, regardless of this flag.
 
 ### `--log.file-name-format`
 
@@ -403,7 +435,7 @@ $ {{ page.command }} --log.file-name-format file-name  --local-repository reposi
 ERR: baz.cer: Certificate validation failed: certificate has expired
 {% endhighlight %}
 
-This flag affects standard output, standard error and syslog.
+This flag affects any of the log output configured at [`--log.output`](#--logoutput) (`syslog` and `console`).
 
 ### `--output.roa`
 
@@ -464,6 +496,8 @@ The configuration options are mostly the same as the ones from the `argv` interf
        },
 
        "log": {
+               "<a href="#--loglevel">level</a>": "warning",
+               "<a href="#--logoutput">output</a>": "console",
                "<a href="#--logcolor-output">color-output</a>": true,
                "<a href="#--logfile-name-format">file-name-format</a>": "file-name"
        },
index 1330f82e81131265622ae7da480e2e6c436cbfce..ffeaa86079112446e7ac297b766d290833be8071 100644 (file)
@@ -1,7 +1,7 @@
 .TH fort 8 "2019-10-14" "v1.1.1" "FORT validator"
 
 .SH NAME
-fort \- RPKI certificate path validator
+fort \- RPKI certificate path validator and RTR server
 
 .SH SYNOPSIS
 .B fort
@@ -420,10 +420,51 @@ maximum allowed value \fI172800\fR. It must be larger than
 .RE
 .P
 
+.BR \-\-log.level=(\fIerror\fR|\fIwarning\fR|\fIinfo\fR|\fIdebug\fR)
+.RS 4
+Defines which messages will be logged according to its priority, e.g. a value
+of \fIinfo\fR will log messages of equal or higher level (\fIinfo\fR,
+\fIwarning\fR, and \fIerror\fR).
+.P
+The priority levels, from higher to lowest, are:
+.RS 4
+.br
+- \fIerror\fR
+.br
+- \fIwarning\fR
+.br
+- \fIinfo\fR
+.br
+- \fIdebug\fR
+.RE
+.P
+By default, it has a value of \fIwarning\fR.
+.RE
+.P
+
+.BR \-\-log.output=(\fIsyslog\fR|\fIconsole\fR)
+.RS 4
+Desired output where the logs will be printed.
+.P
+The value \fIconsole\fR will log messages at standard output and standard error;
+\fIsyslog\fR will log to syslog.
+.P
+Depending on the OS, distinct implementations of syslog could be installed
+(syslog, rsyslog, or syslog-ng are the most common ones). Syslog usage and
+configuration is out of this man scope.
+.P
+By default, it has a value of \fIconsole\fR.
+.P
+More information about Logging can be consulted at FORT's web docs.
+.RE
+.P
+
 .BR \-c ", " \-\-log.color-output
 .RS 4
 If enabled, the logging output will contain ANSI color codes. Meant for human
 consumption.
+.P
+Meaningful only if \fI--log.output\fR value is \fIconsole\fR.
 .RE
 .P
 
@@ -554,6 +595,8 @@ to a specific value:
     }
   },
   "log": {
+    "level": "warning",
+    "output": "console",
     "color-output": true,
     "file-name-format": "local-path"
   },
index 55c48204ff855f444356beb4e831595921a1cc8c..3fe7f2d7e5652a1b58654dcc7b35ffc833632ae8 100644 (file)
@@ -1,6 +1,5 @@
 # Comment these out during releases.
 # Also increase optimization I guess (-O0 -> -On)
-#CFLAGS_DEBUG  = -DDEBUG
 LDFLAGS_DEBUG = -rdynamic
 
 bin_PROGRAMS = fort
@@ -107,7 +106,7 @@ fort_SOURCES += $(ASN_MODULE_SRCS) $(ASN_MODULE_HDRS)
 fort_CFLAGS  = -Wall
 # Feel free to temporarily remove this one if you're not using gcc 7.3.0.
 #fort_CFLAGS += $(GCC_WARNS)
-fort_CFLAGS += -std=gnu11 -O2 -g $(CFLAGS_DEBUG) $(FORT_FLAGS)
+fort_CFLAGS += -std=gnu11 -O2 -g $(FORT_FLAGS)
 fort_LDFLAGS = $(LDFLAGS_DEBUG)
 fort_LDADD   = ${JANSSON_LIBS}