Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

configuration des logs debian rsyslog

1 réponse
Avatar
Kevin Denis
Bonjour,

sous debian, on configure ses logs avec rsyslog.conf

On peut mettre par exemple:
local0.* /var/log/monlog

Et tous les évènements, quels que soient leur gravité,
se retrouvent dans /var/log/monlog.
J'obtiendrai par exemple:
Oct 4 11:34:03 mamachine monprog[20524]: initializing thread 0
Oct 4 11:34:03 mamachine monprog[20524]: initializing thread 1
Oct 4 11:34:03 mamachine monprog[20524]: no conf file
Oct 4 11:34:03 mamachine monprog[20524]: abort

Mais certains évènements sont de l'info (initializing) et
d'autre du warning

Si je veux trier selon les gravités, je peux faire:
local0.warn /var/log/monlog-warn
local0.info /var/log/monlog-info
etc...

Mais ça m'éclate les logs entre plusieurs fichiers.

Est il possible d'ajouter directement dans le log le niveau
de gravité? Pour avoir la conf:
local0.* /var/log/monlog

et dans les logs obtenir:
Oct 4 11:34:03 mamachine monprog[20524]: info: initializing thread 0
Oct 4 11:34:03 mamachine monprog[20524]: info: initializing thread 1
Oct 4 11:34:03 mamachine monprog[20524]: warn: no conf file
Oct 4 11:34:03 mamachine monprog[20524]: warn: abort

Merci
--
Kevin

1 réponse

Avatar
Kevin Denis
Le 04-10-2013, Kevin Denis a écrit :
Est il possible d'ajouter directement dans le log le niveau
de gravité?



Je me réponds à moi meme:
dans /etc/rsyslog.d/monprog.conf
$template monprog,"%TIMESTAMP% %HOSTNAME% %syslogtag% %syslogseverity-text%:%msg%n"
local0.* /var/log/monlog.log;monprog
--
Kevin