Registro

Niveles de log, archivos, syslog y colores de la consola

  1. Ejemplo
  2. Syslog
  3. Variables

Cambia estas variables para ajustar cuánto se registra, adónde van los archivos de log o para mostrar las marcas de tiempo en tu propia zona horaria.


Ejemplo

Registra más en los archivos que en la consola, y muestra las marcas de tiempo del log y de los trabajos en hora de Ámsterdam. En el .env del proyecto compose:

LOG_LEVEL=info
LOG_CONSOLE_LEVEL=notice
LOG_TZ=Europe/Amsterdam

Syslog

Los servidores syslog ya no se configuran aquí: añádelos en Configuración > Conexiones > Syslog, consulta Logs. Las variables LOG_SYSLOG_* de abajo están obsoletas desde la 7. El primer arranque que encuentra LOG_SYSLOG_HOST definida las importa una vez como el servidor syslog syslog, que recibe el registro del servidor, y a partir de entonces las ignora.


Variables

Todas las variables de este grupo, con su tipo, su valor predeterminado y su descripción:

Variable Opciones/Valores predeterminados Comentarios
LOG_FORMAT
string
added in version 7.0.0
Valor predeterminado:
text

Log format
text, json

text (default): <time> <level>: <message>, colored in the console and the log file. json: one JSON object a line - time (ISO), level, message, requestId, role and host - for a log collector (Loki, ELK, Splunk…). Syslog keeps its own format.

Every request gets an id: the X-Request-Id a reverse proxy sent, or a new one. It is returned in the response’s X-Request-Id header and carried by every line written while the request is served ([req <id>] in text), so a request can be followed through the log and matched with the proxy’s.

LOG_LEVEL
string
Opciones:
  • error
  • warning
  • notice (predeterminado)
  • info
  • debug

Log level
emerg, alert, crit, error, warning, notice, info, debug

AnsibleForms logs to a log file called ansibleforms.log.
It does so in multiple levels.
warn is read as warning, in any case. A value that names no level falls back to the default, with one warning in the log naming it.

LOG_RETENTION_DAYS
number
added in version 7.0.0
Valor predeterminado:
30

Log file retention (days)
a whole number where 0 keeps the log files for ever

How many days of server log files are kept: the main log and the errors log, one file a day, zipped once the day is over. Older files are deleted. 0 keeps every file. Takes effect at once, without a restart.

LOG_PATH
string
Valor predeterminado:
%PERSISTENT_FOLDER%/logs

Logs folder
a valid folder path

AnsibleForms maintains 2 logfiles. ansibleforms.log and ansibleforms.errors.log

Añadido 4.0.0

Make the logfiles rotating with daily timestamp. 30days of logs are kept.

LOG_CONSOLE_LEVEL
string
Opciones:
  • error
  • warning
  • notice (predeterminado)
  • info
  • debug

Console log level
emerg, alert, crit, error, warning, notice, info, debug

When you run ansibleforms, by default the application also logs to the console.
For example with docker you can use the command docker logs to access this console log.
This console log has a seperate loglevel.
warn is read as warning, in any case. A value that names no level falls back to the default, with one warning in the log naming it.

LOG_TZ
string
added in version 5.0.10
Valor predeterminado:
UTC

Log time zone
a valid timezone string

Sets the timezone for log timestamps. Use a valid IANA timezone string (e.g., UTC, Europe/Amsterdam, America/New_York). Also used for the job timestamps.

LOG_SYSLOG_HOST
string
added in version 3.0.1
Valor predeterminado:

Syslog host (deprecated)
a valid IP or FQDN

Deprecated since 7, removed in 8. The first 7.x start that finds LOG_SYSLOG_HOST set imports the LOG_SYSLOG_* variables once as the syslog server syslog, getting the server log; after that they are ignored. Manage syslog servers under Connections > Syslog. Setting the syslog host enables the logging to a syslog server. Without it, nothing is sent to syslog.

LOG_SYSLOG_LEVEL
string
added in version 3.0.1
Opciones:
  • error
  • warning
  • notice
  • info
  • debug (predeterminado)

Syslog level (deprecated)
emerg, alert, crit, error, warning, notice, info, debug

Deprecated since 7, removed in 8. The first 7.x start that finds LOG_SYSLOG_HOST set imports the LOG_SYSLOG_* variables once as the syslog server syslog, getting the server log; after that they are ignored. Manage syslog servers under Connections > Syslog. The logging level for the syslog server.
warn is read as warning, in any case. A value that names no level falls back to the default, with one warning in the log naming it.

LOG_SYSLOG_PORT
number
added in version 3.0.1
Valor predeterminado:
514

Syslog port (deprecated)
valid tcp/udp port number

Deprecated since 7, removed in 8. The first 7.x start that finds LOG_SYSLOG_HOST set imports the LOG_SYSLOG_* variables once as the syslog server syslog, getting the server log; after that they are ignored. Manage syslog servers under Connections > Syslog. The port on which the syslog server is listening

LOG_SYSLOG_PROTOCOL
string
added in version 3.0.1
Opciones:
  • tcp4
  • udp4 (predeterminado)
  • tls4
  • unix
  • unix-connect

Syslog protocol (deprecated)
udp, udp4, udp6, tcp, tcp4, tcp6, tls, tls4, tls6, unix, unix-connect

Deprecated since 7, removed in 8. The first 7.x start that finds LOG_SYSLOG_HOST set imports the LOG_SYSLOG_* variables once as the syslog server syslog, getting the server log; after that they are ignored. Manage syslog servers under Connections > Syslog. The syslog protocol to use

LOG_SYSLOG_PATH
string
added in version 3.0.1
Valor predeterminado:
/dev/log

Syslog path (deprecated)
valid syslog path

Deprecated since 7, removed in 8. The first 7.x start that finds LOG_SYSLOG_HOST set imports the LOG_SYSLOG_* variables once as the syslog server syslog, getting the server log; after that they are ignored. Manage syslog servers under Connections > Syslog. The path to the syslog dgram socket (i.e. /dev/log or /var/run/syslog for OS X)

LOG_SYSLOG_SOURCE
string
added in version 3.0.1
Valor predeterminado:
localhost

Syslog source hostname (deprecated)
hostname

Deprecated since 7, removed in 8. The first 7.x start that finds LOG_SYSLOG_HOST set imports the LOG_SYSLOG_* variables once as the syslog server syslog, getting the server log; after that they are ignored. Manage syslog servers under Connections > Syslog. Host to indicate where log messages are coming from

LOG_SYSLOG_TYPE
string
added in version 3.0.1
Opciones:
  • BSD (predeterminado)
  • 3164
  • 5424
  • RFC3164
  • RFC5424

Syslog protocol type (deprecated)
BSD, 5424

Deprecated since 7, removed in 8. The first 7.x start that finds LOG_SYSLOG_HOST set imports the LOG_SYSLOG_* variables once as the syslog server syslog, getting the server log; after that they are ignored. Manage syslog servers under Connections > Syslog. The type of the syslog protocol to use

LOG_SYSLOG_APPNAME
string
added in version 3.0.1
Valor predeterminado:
AnsibleForms

Syslog app name (deprecated)
free text

Deprecated since 7, removed in 8. The first 7.x start that finds LOG_SYSLOG_HOST set imports the LOG_SYSLOG_* variables once as the syslog server syslog, getting the server log; after that they are ignored. Manage syslog servers under Connections > Syslog. The name of the application

LOG_COLOR_ERROR
string
added in version 3.0.1
Valor predeterminado:
\x1b[31m

Error color code
valid escape color code

The escape color code for error (default red)

LOG_COLOR_WARN
string
added in version 3.0.1
Valor predeterminado:
\x1b[33m

Warning color code
valid escape color code

The escape color code for warning (default yellow)

LOG_COLOR_NOTICE
string
added in version 3.0.1
Valor predeterminado:
\x1b[37m

Notice color code
valid escape color code

The escape color code for notice (default white)

LOG_COLOR_INFO
string
added in version 3.0.1
Valor predeterminado:
\x1b[32m

Info color code
valid escape color code

The escape color code for info (default green)

LOG_COLOR_DEBUG
string
added in version 3.0.1
Valor predeterminado:
\x1b[36m

Debug color code
valid escape color code

The escape color code for debug (default cyan)