Project

General

Profile

Tâche #23218

Scénario #22923: Traitement express MEN (08-10)

Rsyslog ne récupère pas la valeur %fromhost%

Added by Mickael Tarier over 3 years ago. Updated about 2 years ago.

Status:
Fermé
Priority:
Normal
Assigned To:
Start date:
03/06/2018
Due date:
% Done:

100%

Estimated time:
2.00 h
Spent time:
Remaining (hours):
0.0

Description

Bonjour

Nous avons dans l'arborescence du syslog, un dossier correspondant à une variable non attribuée.

~:/etc/rsyslog.d/eole-traps# ll /var/log/rsyslog/remote/%fromhost%/
total 12
drwx------ 3 syslog adm 4096 mars   1 02:15 ./
drwxr-xr-x 9 syslog adm 4096 mars   1 02:15 ../
drwx------ 2 syslog adm 4096 mars   6 06:27 eole-schedule/

Après un courte recherche, il semblerait que ce dossier est généré par le fichier /etc/rsyslog.d/eole-traps/eole.conf

# all messages from localhost go in local branch
if $programname == 'eole-schedule' and $fromhost-ip == '127' then {
    action(type="omfile" file="/var/log/rsyslog/local/eole-schedule/eole-schedule.log")
    stop
}
if $programname == 'eole-schedule' then {
    action(type="omfile" file="/var/log/rsyslog/remote/%fromhost%/eole-schedule/eole-schedule.log")
    stop
}

Merci.
Cordialement

Associated revisions

Revision c6711f35 (diff)
Added by Benjamin Bohard over 3 years ago

Utiliser un template pour la journalisation distante des événements de eole-schedule.

Ref #23218

History

#1 Updated by Scrum Master over 3 years ago

  • Description updated (diff)

#2 Updated by Benjamin Bohard over 3 years ago

Il semble que l’on doive utiliser le paramètre dynaFile plutôt que file pour que la variable fromhost soit interprétée.

Ça nécessite donc d’utiliser un template plutôt que la variable fromhost directement dans l’action. Ce qui donnerait quelque chose comme suit :

template(name="remote_eoleschedule" type="string" 
         string="/var/log/rsyslog/remote/%fromhost%/eole-schedule/eole-schedule.log" 
        )

if $programname == 'eole-schedule' then {
    action(type="omfile" dynaFile="remote_eoleschedule")
    stop
}

#3 Updated by Benjamin Bohard over 3 years ago

  • Tracker changed from Demande to Tâche
  • Status changed from Nouveau to En cours
  • Assigned To set to Benjamin Bohard
  • Estimated time set to 2.00 h
  • Parent task set to #22923
  • Remaining (hours) set to 1.0

#4 Updated by Benjamin Bohard over 3 years ago

  • Status changed from En cours to Résolu
  • % Done changed from 0 to 100

Errata

https://dev-eole.ac-dijon.fr/projects/modules-eole/wiki/Errata26

%if %%getVar('activer_reception_logs', 'non') == 'non'
# all messages go in local branch
if $programname == "eole-schedule" then {
    action(type="omfile" file="/var/log/rsyslog/local/eole-schedule/eole-schedule.log")
    stop
}
%else
# all messages from localhost go in local branch
if $programname == 'eole-schedule' and $fromhost-ip == '127' then {
    action(type="omfile" file="/var/log/rsyslog/local/eole-schedule/eole-schedule.log")
    stop
}

template(name="remote_eole_schedule" type="string" 
         string="/var/log/rsyslog/remote/%fromhost%/eole-schedule/eole-schedule.log" 
)

if $programname == 'eole-schedule' then {
    action(type="omfile" dynaFile="remote_eole_schedule")
    stop
}
%end if

#5 Updated by Benjamin Bohard over 3 years ago

  • Remaining (hours) changed from 1.0 to 0.25

#6 Updated by Gérald Schwartzmann over 3 years ago

  • Remaining (hours) changed from 0.25 to 0.0

#8 Updated by Gérald Schwartzmann over 3 years ago

Envoi de journaux Scribe sur Zéphir.

Sur le scribe :
Ajout d'un job puis lancement du cron

# /usr/share/eole/schedule/schedule cron

root@zephir:~# ll /var/log/rsyslog/remote/
total 20
drwxr-xr-x  5 syslog adm 4096 mars  12 16:39 ./
drwxr-xr-x  4 syslog adm 4096 mars  12 16:38 ../
drwx------  3 syslog adm 4096 mars  12 16:38 %fromhost%/
drwxr-xr-x 12 syslog adm 4096 mars  12 16:39 scribe.ac-test.fr/
drwxr-xr-x  3 syslog adm 4096 mars  12 16:39 zephir.ac-test.fr/
root@zephir:~#
root@zephir:~# rm -rf /var/log/rsyslog/remote/%fromhost%/
~/Dev/EOLE/eole-common/tmpl[master]$ scp rsyslog_traps_eole.conf root@zephir.ac-test.fr:/usr/share/eole/creole/distrib/rsyslog_traps_eole.conf
reconfigure
root@scribe:~# /usr/share/eole/schedule/schedule cron
root@zephir:~# ll /var/log/rsyslog/remote/
total 16
drwxr-xr-x  4 syslog adm 4096 mars  12 16:43 ./
drwxr-xr-x  4 syslog adm 4096 mars  12 16:38 ../
drwxr-xr-x 55 syslog adm 4096 mars  12 16:51 scribe.ac-test.fr/
drwxr-xr-x  3 syslog adm 4096 mars  12 16:39 zephir.ac-test.fr/
root@zephir:~# 

#9 Updated by Gérald Schwartzmann over 3 years ago

  • Status changed from Résolu to Fermé

#10 Updated by Benjamin Bohard about 2 years ago

Errata corrigé pour vraiment utiliser dynaFile plutôt que file (cf https://dev-eole.ac-dijon.fr/issues/28044)

Also available in: Atom PDF