Différences
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentesRévision précédente | |||
elearning:workbooks:centos:8:junior:l122 [2024/10/01 08:02] – removed admin | elearning:workbooks:centos:8:junior:l122 [2024/10/01 08:03] (Version actuelle) – created admin | ||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
+ | ~~PDF: | ||
+ | Version : **2024.01** | ||
+ | |||
+ | Dernière mise-à-jour : ~~LASTMOD~~ | ||
+ | |||
+ | ======LCF602 - Gestion de la Journalisation====== | ||
+ | |||
+ | =====Contenu du Module===== | ||
+ | |||
+ | * **LCF602 - Gestion de la Journalisation** | ||
+ | * Présentation | ||
+ | * La Commande dmesg | ||
+ | * LAB #1 - Surveillance Sécuritaire | ||
+ | * 1.1 - La Commande last | ||
+ | * 1.2 - La Commande lastlog | ||
+ | * 1.3 - La Commande lastb | ||
+ | * 1.4 - Le Fichier / | ||
+ | * 1.5 - Gestion des évènements audit | ||
+ | * Le fichier / | ||
+ | * auditd | ||
+ | * auditctl | ||
+ | * audispd | ||
+ | * La consultation des événements audit | ||
+ | * La Commande aureport | ||
+ | * La Commande ausearch | ||
+ | * Le fichier / | ||
+ | * Applications | ||
+ | * LAB #2 - rsyslog | ||
+ | * 2.1 - Priorités | ||
+ | * 2.2 - Sous-systèmes applicatifs | ||
+ | * 2.3 - / | ||
+ | * Modules | ||
+ | * Directives Globales | ||
+ | * Règles | ||
+ | * Sous-système applicatif.Priorité | ||
+ | * Sous-système applicatif!Priorité | ||
+ | * Sous-système applicatif=Priorité | ||
+ | * L' | ||
+ | * n Sous-systèmes avec la même priorité | ||
+ | * n Sélecteurs avec la même Action | ||
+ | * LAB #3 - La Commande logger | ||
+ | * LAB #4 - La Commande logrotate | ||
+ | * LAB #5 - La Journalisation avec journald | ||
+ | * 5.1 - Consultation des Journaux | ||
+ | * 5.2 - Consultation des Journaux d'une Application Spécifique | ||
+ | * 5.3 - Consultation des Journaux depuis le Dernier Démarrage | ||
+ | * 5.4 - Consultation des Journaux d'une Priorité Spécifique | ||
+ | * 5.5 - Consultation des Journaux d'une Plage de Dates ou d' | ||
+ | * 5.6 - Consultation des Journaux en Live | ||
+ | * 5.7 - Consultation des Journaux avec des Mots Clefs | ||
+ | |||
+ | =====Présentation===== | ||
+ | |||
+ | La majorité des journaux du système et des applications se trouve dans le répertoire **/ | ||
+ | |||
+ | <WRAP center round important 60%> | ||
+ | **Important** : Il est conseillé de déplacer le point de montage du répertoire **/ | ||
+ | </ | ||
+ | |||
+ | =====La Commande / | ||
+ | |||
+ | Cette commande retourne les messages du noyau (**//Kernel Ring Buffer//**) stockés dans le fichier **/ | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# dmesg | more | ||
+ | [ 0.000000] Linux version 4.18.0-240.22.1.el8_3.x86_64 (mockbuild@kbuilder.bsys.centos.org) (gcc version 8.3.1 20191121 (Red Hat 8.3.1-5) (G | ||
+ | CC)) #1 SMP Thu Apr 8 19:01:30 UTC 2021 | ||
+ | [ 0.000000] Command line: BOOT_IMAGE=(hd0, | ||
+ | shkernel=auto resume=UUID=c8bb3f47-d67f-4b21-b781-766899dc83d4 rhgb quiet | ||
+ | [ 0.000000] x86/fpu: Supporting XSAVE feature 0x001: 'x87 floating point registers' | ||
+ | [ 0.000000] x86/fpu: Supporting XSAVE feature 0x002: 'SSE registers' | ||
+ | [ 0.000000] x86/fpu: Supporting XSAVE feature 0x004: 'AVX registers' | ||
+ | [ 0.000000] x86/fpu: xstate_offset[2]: | ||
+ | [ 0.000000] x86/fpu: Enabled xstate features 0x7, context size is 832 bytes, using ' | ||
+ | [ 0.000000] BIOS-provided physical RAM map: | ||
+ | [ 0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009fbff] usable | ||
+ | [ 0.000000] BIOS-e820: [mem 0x000000000009fc00-0x000000000009ffff] reserved | ||
+ | [ 0.000000] BIOS-e820: [mem 0x00000000000f0000-0x00000000000fffff] reserved | ||
+ | [ 0.000000] BIOS-e820: [mem 0x0000000000100000-0x00000000dffeffff] usable | ||
+ | [ 0.000000] BIOS-e820: [mem 0x00000000dfff0000-0x00000000dfffffff] ACPI data | ||
+ | [ 0.000000] BIOS-e820: [mem 0x00000000fec00000-0x00000000fec00fff] reserved | ||
+ | [ 0.000000] BIOS-e820: [mem 0x00000000fee00000-0x00000000fee00fff] reserved | ||
+ | [ 0.000000] BIOS-e820: [mem 0x00000000fffc0000-0x00000000ffffffff] reserved | ||
+ | [ 0.000000] BIOS-e820: [mem 0x0000000100000000-0x000000011fffffff] usable | ||
+ | [ 0.000000] NX (Execute Disable) protection: active | ||
+ | [ 0.000000] SMBIOS 2.5 present. | ||
+ | [ 0.000000] DMI: innotek GmbH VirtualBox/ | ||
+ | [ 0.000000] Hypervisor detected: KVM | ||
+ | --More-- | ||
+ | </ | ||
+ | |||
+ | Les option de cette commande sont : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# dmesg --help | ||
+ | |||
+ | Usage: | ||
+ | dmesg [options] | ||
+ | |||
+ | Display or control the kernel ring buffer. | ||
+ | |||
+ | Options: | ||
+ | -C, --clear | ||
+ | -c, --read-clear | ||
+ | -D, --console-off | ||
+ | -E, --console-on | ||
+ | -F, --file < | ||
+ | -f, --facility < | ||
+ | -H, --human | ||
+ | -k, --kernel | ||
+ | -L, --color[=< | ||
+ | | ||
+ | -l, --level < | ||
+ | -n, --console-level < | ||
+ | -P, --nopager | ||
+ | -p, --force-prefix | ||
+ | -r, --raw print the raw message buffer | ||
+ | -S, --syslog | ||
+ | -s, --buffer-size < | ||
+ | -u, --userspace | ||
+ | -w, --follow | ||
+ | -x, --decode | ||
+ | -d, --show-delta | ||
+ | -e, --reltime | ||
+ | -T, --ctime | ||
+ | -t, --notime | ||
+ | | ||
+ | | ||
+ | Suspending/ | ||
+ | |||
+ | -h, --help | ||
+ | -V, --version | ||
+ | |||
+ | Supported log facilities: | ||
+ | kern - kernel messages | ||
+ | user - random user-level messages | ||
+ | mail - mail system | ||
+ | daemon - system daemons | ||
+ | auth - security/ | ||
+ | syslog - messages generated internally by syslogd | ||
+ | lpr - line printer subsystem | ||
+ | news - network news subsystem | ||
+ | |||
+ | Supported log levels (priorities): | ||
+ | emerg - system is unusable | ||
+ | alert - action must be taken immediately | ||
+ | crit - critical conditions | ||
+ | err - error conditions | ||
+ | warn - warning conditions | ||
+ | notice - normal but significant condition | ||
+ | info - informational | ||
+ | debug - debug-level messages | ||
+ | |||
+ | For more details see dmesg(1). | ||
+ | </ | ||
+ | |||
+ | =====LAB #1 - Surveillance Sécuritaire===== | ||
+ | |||
+ | ====1.1 - La Commande last==== | ||
+ | |||
+ | Cette commande indique les dates et heures des connexions des utilisateurs à partir du contenu du fichier **/ | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# last | ||
+ | trainee | ||
+ | reboot | ||
+ | trainee | ||
+ | trainee | ||
+ | reboot | ||
+ | trainee | ||
+ | reboot | ||
+ | trainee | ||
+ | reboot | ||
+ | trainee | ||
+ | trainee | ||
+ | reboot | ||
+ | trainee | ||
+ | trainee | ||
+ | trainee | ||
+ | trainee | ||
+ | reboot | ||
+ | trainee | ||
+ | trainee | ||
+ | trainee | ||
+ | trainee | ||
+ | trainee | ||
+ | trainee | ||
+ | trainee | ||
+ | trainee | ||
+ | trainee | ||
+ | reboot | ||
+ | trainee | ||
+ | reboot | ||
+ | trainee | ||
+ | reboot | ||
+ | reboot | ||
+ | |||
+ | wtmp begins Fri May 8 08:13:49 2020 | ||
+ | </ | ||
+ | |||
+ | Les option de cette commande sont : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# last --help | ||
+ | |||
+ | Usage: | ||
+ | last [options] [< | ||
+ | |||
+ | Show a listing of last logged in users. | ||
+ | |||
+ | Options: | ||
+ | | ||
+ | -a, --hostlast | ||
+ | -d, --dns translate the IP number back into a hostname | ||
+ | -f, --file < | ||
+ | -F, --fulltimes | ||
+ | -i, --ip | ||
+ | -n, --limit < | ||
+ | -R, --nohostname | ||
+ | -s, --since < | ||
+ | -t, --until < | ||
+ | -p, --present < | ||
+ | -w, --fullnames | ||
+ | -x, --system | ||
+ | | ||
+ | | ||
+ | |||
+ | -h, --help | ||
+ | -V, --version | ||
+ | |||
+ | For more details see last(1). | ||
+ | </ | ||
+ | |||
+ | ====1.2 - La Commande lastlog==== | ||
+ | |||
+ | Cette commande indique les dates et heures de la connexion au système la plus récente des utilisateurs : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# lastlog | ||
+ | Username | ||
+ | root | ||
+ | bin **Never logged in** | ||
+ | daemon | ||
+ | adm **Never logged in** | ||
+ | lp | ||
+ | sync | ||
+ | shutdown | ||
+ | halt | ||
+ | mail | ||
+ | operator | ||
+ | games **Never logged in** | ||
+ | ftp **Never logged in** | ||
+ | nobody | ||
+ | dbus | ||
+ | systemd-coredump | ||
+ | systemd-resolve | ||
+ | tss **Never logged in** | ||
+ | polkitd | ||
+ | unbound | ||
+ | libstoragemgmt | ||
+ | cockpit-ws | ||
+ | sssd | ||
+ | setroubleshoot | ||
+ | sshd | ||
+ | chrony | ||
+ | tcpdump | ||
+ | trainee | ||
+ | cockpit-wsinstance | ||
+ | rngd | ||
+ | gluster | ||
+ | qemu | ||
+ | rpc **Never logged in** | ||
+ | rpcuser | ||
+ | saslauth | ||
+ | radvd **Never logged in** | ||
+ | dnsmasq | ||
+ | fenestros2 | ||
+ | fenestros1 | ||
+ | apache | ||
+ | </ | ||
+ | |||
+ | Les option de cette commande sont : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# lastlog --help | ||
+ | Usage: lastlog [options] | ||
+ | |||
+ | Options: | ||
+ | -b, --before DAYS print only lastlog records older than DAYS | ||
+ | -C, --clear | ||
+ | -h, --help | ||
+ | -R, --root CHROOT_DIR | ||
+ | -S, --set set lastlog record to current time (usable only with -u) | ||
+ | -t, --time DAYS print only lastlog records more recent than DAYS | ||
+ | -u, --user LOGIN print lastlog record of the specified LOGIN | ||
+ | </ | ||
+ | |||
+ | ====1.3 - La Commande lastb==== | ||
+ | |||
+ | Cette commande indique les dates et heures des connexions infructueuses des utilisateurs à partir du contenu du fichier **/ | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# lastb | ||
+ | trainee | ||
+ | trainee | ||
+ | trqinee | ||
+ | |||
+ | btmp begins Thu Jun 3 09:51:07 2021 | ||
+ | </ | ||
+ | |||
+ | Les options de cette commande sont : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# lastb --help | ||
+ | |||
+ | Usage: | ||
+ | lastb [options] [< | ||
+ | |||
+ | Show a listing of last logged in users. | ||
+ | |||
+ | Options: | ||
+ | | ||
+ | -a, --hostlast | ||
+ | -d, --dns translate the IP number back into a hostname | ||
+ | -f, --file < | ||
+ | -F, --fulltimes | ||
+ | -i, --ip | ||
+ | -n, --limit < | ||
+ | -R, --nohostname | ||
+ | -s, --since < | ||
+ | -t, --until < | ||
+ | -p, --present < | ||
+ | -w, --fullnames | ||
+ | -x, --system | ||
+ | | ||
+ | | ||
+ | |||
+ | -h, --help | ||
+ | -V, --version | ||
+ | |||
+ | For more details see last(1). | ||
+ | </ | ||
+ | |||
+ | ====1.4 - Le Fichier / | ||
+ | |||
+ | Sous RHEL/CentOS ce fichier contient la journalisation des opérations de gestion des authentifications : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# tail -n 15 / | ||
+ | Jun 3 09:01:20 centos8 sshd[905]: Server listening on :: port 22. | ||
+ | Jun 3 09:01:39 centos8 sshd[1585]: Accepted password for trainee from 10.0.2.2 port 52734 ssh2 | ||
+ | Jun 3 09:01:39 centos8 systemd[1590]: | ||
+ | Jun 3 09:01:39 centos8 sshd[1585]: pam_unix(sshd: | ||
+ | Jun 3 09:01:46 centos8 su[1627]: pam_systemd(su-l: | ||
+ | Jun 3 09:01:46 centos8 su[1627]: pam_unix(su-l: | ||
+ | Jun 3 09:51:05 centos8 login[1158]: | ||
+ | Jun 3 09:51:05 centos8 login[1158]: | ||
+ | Jun 3 09:51:07 centos8 login[1158]: | ||
+ | Jun 3 09:51:18 centos8 unix_chkpwd[2400]: | ||
+ | Jun 3 09:51:18 centos8 login[1158]: | ||
+ | Jun 3 09:51:20 centos8 login[1158]: | ||
+ | Jun 3 09:51:45 centos8 login[1158]: | ||
+ | Jun 3 09:51:45 centos8 login[1158]: | ||
+ | Jun 3 09:51:47 centos8 login[1158]: | ||
+ | </ | ||
+ | |||
+ | ====1.5 - Gestion des Evénements audit==== | ||
+ | |||
+ | ===Le fichier / | ||
+ | |||
+ | Ce fichier contient les messages du système d' | ||
+ | |||
+ | * des appels système, | ||
+ | * des accès aux fichiers, | ||
+ | * des informations en provenance de %%SELinux%%. | ||
+ | |||
+ | Consultez maintenant le fichier **/ | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# tail -n 15 / | ||
+ | type=PROCTITLE msg=audit(1622728321.894: | ||
+ | type=USER_START msg=audit(1622728321.901: | ||
+ | type=CRED_REFR msg=audit(1622728321.902: | ||
+ | type=CRED_DISP msg=audit(1622728321.908: | ||
+ | type=USER_END msg=audit(1622728321.910: | ||
+ | type=SERVICE_STOP msg=audit(1622728330.965: | ||
+ | type=USER_ACCT msg=audit(1622728381.954: | ||
+ | type=CRED_ACQ msg=audit(1622728381.954: | ||
+ | type=LOGIN msg=audit(1622728381.954: | ||
+ | type=SYSCALL msg=audit(1622728381.954: | ||
+ | type=PROCTITLE msg=audit(1622728381.954: | ||
+ | type=USER_START msg=audit(1622728381.960: | ||
+ | type=CRED_REFR msg=audit(1622728381.962: | ||
+ | type=CRED_DISP msg=audit(1622728381.966: | ||
+ | type=USER_END msg=audit(1622728381.968: | ||
+ | </ | ||
+ | |||
+ | La gestion des événements audit se repose sur trois exécutables : | ||
+ | |||
+ | ===auditd=== | ||
+ | |||
+ | Cet exécutable est le daemon du système audit. Il est responsable de l’écriture des enregistrements audit sur disque. Son fichier de configuration est le **/ | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# cat / | ||
+ | # | ||
+ | # This file controls the configuration of the audit daemon | ||
+ | # | ||
+ | |||
+ | local_events = yes | ||
+ | write_logs = yes | ||
+ | log_file = / | ||
+ | log_group = root | ||
+ | log_format = ENRICHED | ||
+ | flush = INCREMENTAL_ASYNC | ||
+ | freq = 50 | ||
+ | max_log_file = 8 | ||
+ | num_logs = 5 | ||
+ | priority_boost = 4 | ||
+ | name_format = NONE | ||
+ | ##name = mydomain | ||
+ | max_log_file_action = ROTATE | ||
+ | space_left = 75 | ||
+ | space_left_action = SYSLOG | ||
+ | verify_email = yes | ||
+ | action_mail_acct = root | ||
+ | admin_space_left = 50 | ||
+ | admin_space_left_action = SUSPEND | ||
+ | disk_full_action = SUSPEND | ||
+ | disk_error_action = SUSPEND | ||
+ | use_libwrap = yes | ||
+ | ## | ||
+ | tcp_listen_queue = 5 | ||
+ | tcp_max_per_addr = 1 | ||
+ | ## | ||
+ | tcp_client_max_idle = 0 | ||
+ | transport = TCP | ||
+ | krb5_principal = auditd | ||
+ | ## | ||
+ | distribute_network = no | ||
+ | q_depth = 400 | ||
+ | overflow_action = SYSLOG | ||
+ | max_restarts = 10 | ||
+ | plugin_dir = / | ||
+ | </ | ||
+ | |||
+ | Les option de cette commande sont : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# auditd --help | ||
+ | auditd: unrecognized option ' | ||
+ | Usage: auditd [-f] [-l] [-n] [-s disable|enable|nochange] [-c < | ||
+ | </ | ||
+ | |||
+ | ===auditctl=== | ||
+ | |||
+ | Cet exécutable est utilisé pour configurer les règles du système audit. Au démarrage, auditctl lit et applique les règles contunues dans le fichier **/ | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# cat / | ||
+ | ## This file is automatically generated from / | ||
+ | -D | ||
+ | -b 8192 | ||
+ | -f 1 | ||
+ | --backlog_wait_time 60000 | ||
+ | |||
+ | </ | ||
+ | |||
+ | Les options de cette commande sont : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# auditctl --help | ||
+ | usage: auditctl [options] | ||
+ | -a < | ||
+ | -A < | ||
+ | -b < | ||
+ | allowed Default=64 | ||
+ | -c Continue through errors in rules | ||
+ | -C f=f Compare collected fields if available: | ||
+ | Field name, operator(=, | ||
+ | -d < | ||
+ | l=task, | ||
+ | a=never, | ||
+ | -D Delete all rules and watches | ||
+ | -e [0..2] | ||
+ | -f [0..2] | ||
+ | 0=silent 1=printk 2=panic | ||
+ | -F f=v Build rule: field name, operator(=, | ||
+ | > | ||
+ | -h Help | ||
+ | -i Ignore errors when reading rules from file | ||
+ | -k < | ||
+ | -l List rules | ||
+ | -m text Send a user-space message | ||
+ | -p [r|w|x|a] | ||
+ | r=read, w=write, x=execute, a=attribute | ||
+ | -q < | ||
+ | -r < | ||
+ | -R < | ||
+ | -s Report status | ||
+ | -S syscall | ||
+ | -t Trim directory watches | ||
+ | -v Version | ||
+ | -w < | ||
+ | -W < | ||
+ | --loginuid-immutable | ||
+ | --backlog_wait_time | ||
+ | --reset-lost | ||
+ | </ | ||
+ | |||
+ | ===La consultation des événements audit=== | ||
+ | |||
+ | La consultation des événements audit se fait en utilisant les commandes **ausearch** et **aureport** : | ||
+ | |||
+ | ==La Commande aureport== | ||
+ | |||
+ | Cette commande est utilisée pour générer des rapports : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# aureport | ||
+ | |||
+ | Summary Report | ||
+ | ====================== | ||
+ | Range of time in logs: 05/08/2020 08: | ||
+ | Selected time for report: 05/08/2020 08:13:52 - 06/03/2021 10: | ||
+ | Number of changes in configuration: | ||
+ | Number of changes to accounts, groups, or roles: 56 | ||
+ | Number of logins: 21 | ||
+ | Number of failed logins: 5 | ||
+ | Number of authentications: | ||
+ | Number of failed authentications: | ||
+ | Number of users: 3 | ||
+ | Number of terminals: 10 | ||
+ | Number of host names: 4 | ||
+ | Number of executables: | ||
+ | Number of commands: 11 | ||
+ | Number of files: 0 | ||
+ | Number of AVC's: 0 | ||
+ | Number of MAC events: 35 | ||
+ | Number of failed syscalls: 0 | ||
+ | Number of anomaly events: 7 | ||
+ | Number of responses to anomaly events: 0 | ||
+ | Number of crypto events: 287 | ||
+ | Number of integrity events: 0 | ||
+ | Number of virt events: 0 | ||
+ | Number of keys: 0 | ||
+ | Number of process IDs: 616 | ||
+ | Number of events: 6030 | ||
+ | </ | ||
+ | |||
+ | Les options de cette commande sont : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# aureport --help | ||
+ | usage: aureport [options] | ||
+ | -a, | ||
+ | -au, | ||
+ | --comm Commands run report | ||
+ | -c, | ||
+ | -cr, | ||
+ | -e, | ||
+ | -f, | ||
+ | --failed only failed events in report | ||
+ | -h, | ||
+ | --help help | ||
+ | -i, | ||
+ | -if, | ||
+ | --input-logs Use the logs even if stdin is a pipe | ||
+ | --integrity Integrity event report | ||
+ | -l, | ||
+ | -k, | ||
+ | -m, | ||
+ | -ma, | ||
+ | -n, | ||
+ | -nc, | ||
+ | --node <node name> | ||
+ | -p, | ||
+ | -r, | ||
+ | -s, | ||
+ | --success only success events in report | ||
+ | --summary sorted totals for main object in report | ||
+ | -t, | ||
+ | -te,--end [end date] [end time] ending date & time for reports | ||
+ | -tm, | ||
+ | -ts, | ||
+ | --tty Report about tty keystrokes | ||
+ | -u, | ||
+ | -v, | ||
+ | --virt Virtualization report | ||
+ | -x, | ||
+ | If no report is given, the summary report will be displayed | ||
+ | </ | ||
+ | |||
+ | ==La Commande ausearch== | ||
+ | |||
+ | Cette commande est utilisée pour rechercher des événements. Par exemple, pour rechercher les événements liés à un utilisateur représenté par son UID : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# ausearch -ui 1000 | more | ||
+ | ---- | ||
+ | time-> | ||
+ | type=USER_AUTH msg=audit(1598972728.209: | ||
+ | omain addr=? terminal=pts/ | ||
+ | ---- | ||
+ | time-> | ||
+ | type=USER_ACCT msg=audit(1598972728.214: | ||
+ | ost.localdomain addr=? terminal=pts/ | ||
+ | ---- | ||
+ | time-> | ||
+ | type=CRED_ACQ msg=audit(1598972728.218: | ||
+ | dr=? terminal=pts/ | ||
+ | ---- | ||
+ | time-> | ||
+ | type=USER_START msg=audit(1598972728.223: | ||
+ | ,pam_xauth acct=" | ||
+ | ---- | ||
+ | time-> | ||
+ | type=USER_END msg=audit(1598973013.687: | ||
+ | pam_xauth acct=" | ||
+ | ---- | ||
+ | time-> | ||
+ | type=CRED_DISP msg=audit(1598973013.687: | ||
+ | ddr=? terminal=pts/ | ||
+ | ---- | ||
+ | time-> | ||
+ | type=USER_AUTH msg=audit(1618847281.847: | ||
+ | ng.loc addr=? terminal=pts/ | ||
+ | ---- | ||
+ | time-> | ||
+ | type=USER_ACCT msg=audit(1618847281.847: | ||
+ | 8.ittraining.loc addr=? terminal=pts/ | ||
+ | ---- | ||
+ | time-> | ||
+ | type=CRED_ACQ msg=audit(1618847281.847: | ||
+ | ddr=? terminal=pts/ | ||
+ | ---- | ||
+ | time-> | ||
+ | type=USER_START msg=audit(1618847281.883: | ||
+ | ,pam_xauth acct=" | ||
+ | ---- | ||
+ | time-> | ||
+ | type=USER_END msg=audit(1618848279.544: | ||
+ | ,pam_xauth acct=" | ||
+ | ---- | ||
+ | time-> | ||
+ | type=CRED_DISP msg=audit(1618848279.544: | ||
+ | | ||
+ | ---- | ||
+ | time-> | ||
+ | type=USER_AUTH msg=audit(1618848357.204: | ||
+ | addr=? terminal=pts/ | ||
+ | ---- | ||
+ | time-> | ||
+ | type=USER_AUTH msg=audit(1618848363.134: | ||
+ | ng.loc addr=? terminal=pts/ | ||
+ | ---- | ||
+ | --More-- | ||
+ | </ | ||
+ | |||
+ | Les options de cette commande sont : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# ausearch --help | ||
+ | usage: ausearch [options] | ||
+ | -a,--event <Audit event id> | ||
+ | --arch < | ||
+ | -c, | ||
+ | --checkpoint < | ||
+ | --debug Write malformed events that are skipped to stderr | ||
+ | -e, | ||
+ | -f, | ||
+ | --format [raw|default|interpret|csv|text] results format options | ||
+ | -ga, | ||
+ | -ge, | ||
+ | group id | ||
+ | -gi,--gid <Group Id> | ||
+ | -h, | ||
+ | -hn,--host <Host Name> | ||
+ | -i, | ||
+ | -if, | ||
+ | --input-logs Use the logs even if stdin is a pipe | ||
+ | --just-one Emit just one event | ||
+ | -k, | ||
+ | -l, --line-buffered Flush output on every line | ||
+ | -m, | ||
+ | -n, | ||
+ | -o, | ||
+ | -p, | ||
+ | -pp,--ppid <Parent Process id> | ||
+ | -r, | ||
+ | -sc, | ||
+ | -se, | ||
+ | object | ||
+ | --session <login session id> | ||
+ | -su, | ||
+ | -sv, | ||
+ | success value | ||
+ | -te,--end [end date] [end time] ending date & time for search | ||
+ | -ts, | ||
+ | -tm, | ||
+ | -ua, | ||
+ | -ue, | ||
+ | user id | ||
+ | -ui,--uid <User Id> | ||
+ | -ul, | ||
+ | -uu,--uuid <guest UUID> | ||
+ | machine with the given UUID. | ||
+ | -v, | ||
+ | -vm, | ||
+ | machine with the name. | ||
+ | -w, | ||
+ | -x, | ||
+ | </ | ||
+ | |||
+ | <WRAP center round important 60%> | ||
+ | **Important** : Pour plus d' | ||
+ | </ | ||
+ | |||
+ | =====Le fichier / | ||
+ | |||
+ | Ce fichier contient la plupart des messages du système : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# tail -n 15 / | ||
+ | Jun 3 10:15:01 centos8 systemd[1]: session-76.scope: | ||
+ | Jun 3 10:16:01 centos8 systemd[1]: Started Session 77 of user trainee. | ||
+ | Jun 3 10:16:01 centos8 systemd[1]: session-77.scope: | ||
+ | Jun 3 10:17:01 centos8 systemd[1]: Started Session 78 of user trainee. | ||
+ | Jun 3 10:17:01 centos8 systemd[1]: session-78.scope: | ||
+ | Jun 3 10:18:01 centos8 systemd[1]: Started Session 79 of user trainee. | ||
+ | Jun 3 10:18:01 centos8 systemd[1]: session-79.scope: | ||
+ | Jun 3 10:19:01 centos8 systemd[1]: Started Session 80 of user trainee. | ||
+ | Jun 3 10:19:01 centos8 systemd[1]: session-80.scope: | ||
+ | Jun 3 10:20:02 centos8 systemd[1]: Started Session 81 of user trainee. | ||
+ | Jun 3 10:20:02 centos8 systemd[1]: session-81.scope: | ||
+ | Jun 3 10:21:01 centos8 systemd[1]: Started Session 82 of user trainee. | ||
+ | Jun 3 10:21:01 centos8 systemd[1]: session-82.scope: | ||
+ | Jun 3 10:22:01 centos8 systemd[1]: Started Session 83 of user trainee. | ||
+ | Jun 3 10:22:01 centos8 systemd[1]: session-83.scope: | ||
+ | </ | ||
+ | |||
+ | =====Applications===== | ||
+ | |||
+ | Certaines applications consignent leurs journaux dans des répertoires spécifiques. Par exemple : | ||
+ | |||
+ | * cups, | ||
+ | * httpd, | ||
+ | * samba, | ||
+ | * ... | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# ls -l /var/log | ||
+ | total 2448 | ||
+ | drwxr-xr-x. 2 root | ||
+ | drwx------. 2 root | ||
+ | -rw-------. 1 root | ||
+ | -rw-------. 1 root | ||
+ | -rw-------. 1 root | ||
+ | -rw-------. 1 root | ||
+ | -rw-------. 1 root | ||
+ | -rw-rw----. 1 root | ||
+ | -rw-rw----. 1 root | ||
+ | drwxr-xr-x. 2 chrony chrony | ||
+ | -rw-------. 1 root | ||
+ | -rw-------. 1 root | ||
+ | -rw-------. 1 root | ||
+ | -rw-------. 1 root | ||
+ | -rw-------. 1 root | ||
+ | -rw-r--r--. 1 root | ||
+ | -rw-------. 1 root | ||
+ | -rw-------. 1 root | ||
+ | -rw-r--r--. 1 root | ||
+ | -rw-r--r--. 1 root | ||
+ | -rw-r-----. 1 root | ||
+ | drwxr-xr-x. 2 root | ||
+ | -rw-------. 1 root | ||
+ | -rw-r--r--. 1 root | ||
+ | -rw-------. 1 root | ||
+ | -rw-------. 1 root | ||
+ | -rw-rw-r--. 1 root | ||
+ | drwx------. 3 root | ||
+ | -rw-------. 1 root | ||
+ | -rw-------. 1 root | ||
+ | -rw-------. 1 root | ||
+ | -rw-------. 1 root | ||
+ | -rw-------. 1 root | ||
+ | -rw-------. 1 root | ||
+ | -rw-------. 1 root | ||
+ | -rw-------. 1 root | ||
+ | drwx------. 2 root | ||
+ | drwx------. 3 root | ||
+ | -rw-------. 1 root | ||
+ | -rw-------. 1 root | ||
+ | -rw-------. 1 root | ||
+ | -rw-------. 1 root | ||
+ | -rw-------. 1 root | ||
+ | -rw-------. 1 root | ||
+ | -rw-------. 1 root | ||
+ | -rw-------. 1 root | ||
+ | drwxr-x---. 2 sssd | ||
+ | drwxr-xr-x. 3 root | ||
+ | drwxr-xr-x. 2 root | ||
+ | -rw-rw-r--. 1 root | ||
+ | </ | ||
+ | |||
+ | =====LAB #2 - rsyslog===== | ||
+ | |||
+ | **rsyslog**, | ||
+ | |||
+ | rsyslog apporte des améliorations par rapport à syslogd : | ||
+ | |||
+ | * l' | ||
+ | * la haute disponibilité, | ||
+ | * l' | ||
+ | |||
+ | Les messages de journalisation envoyés à rsyslog sont marqués avec un **Sous-système applicatif** et une **Priorité**. Le binôme Sous-système applicatif/ | ||
+ | |||
+ | rsyslog décide ensuite de l' | ||
+ | |||
+ | * ignorer les informations, | ||
+ | * envoyer les informations à un rsyslog sur une autre machine (par exemple, **@machine2**), | ||
+ | * inscrire les informations dans un fichier sur disque (par exemple, **/ | ||
+ | * transmettre les informations à un utilisateur (par exemple **root**), | ||
+ | * transmettre les informations à tous les utilisateurs (par exemple *****), | ||
+ | * transmettre les informations à une application liée à rsyslog via un tube (par exemple, **|logrotate**). | ||
+ | |||
+ | Sous RHEL/ | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# cat / | ||
+ | # Options for rsyslogd | ||
+ | # Syslogd options are deprecated since rsyslog v3. | ||
+ | # If you want to use them, switch to compatibility mode 2 by "-c 2" | ||
+ | # See rsyslogd(8) for more details | ||
+ | SYSLOGD_OPTIONS="" | ||
+ | </ | ||
+ | |||
+ | L' | ||
+ | |||
+ | ^ Directive ^ Version ^ | ||
+ | | SYSLOGD_OPTIONS=" | ||
+ | | SYSLOGD_OPTIONS=" | ||
+ | | SYSLOGD_OPTIONS=" | ||
+ | |||
+ | ====2.1 - Priorités==== | ||
+ | |||
+ | La **Priorité** permet d' | ||
+ | |||
+ | ^ Niveau ^ Priorité ^ Description ^ | ||
+ | | 0 | emerg/panic | Système inutilisable | | ||
+ | | 1 | alert | Action immédiate requise | | ||
+ | | 2 | crit | Condition critique atteinte | | ||
+ | | 3 | err/error | Erreurs rencontrées | | ||
+ | | 4 | warning/ | ||
+ | | 5 | notice | Condition normale - message important | | ||
+ | | 6 | info | Condition normale - message simple | | ||
+ | | 7 | debug | Condition normale - message de débogage | | ||
+ | |||
+ | ====2.2 - Sous-systèmes applicatifs==== | ||
+ | |||
+ | Le **Sous-système applicatif**, | ||
+ | |||
+ | ^ Fonction ^ Description ^ | ||
+ | | auth/ | ||
+ | | cron | Message de cron ou at | | ||
+ | | daemon | Message d'un daemon | | ||
+ | | kern | Message du noyau | | ||
+ | | lpr | Message du système d' | ||
+ | | mail | Message du système de mail | | ||
+ | | news | Message du système de news | | ||
+ | | syslog | Message interne de rsyslogd | | ||
+ | | user | Message utilisateur | | ||
+ | | uucp | Message du système UUCP | | ||
+ | | local0 - local7 | Réservés pour des utilisations locales | | ||
+ | |||
+ | |||
+ | ====2.3 - / | ||
+ | |||
+ | rsyslog est configuré par le fichier **/ | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# cat / | ||
+ | # rsyslog configuration file | ||
+ | |||
+ | # For more information see / | ||
+ | # or latest version online at http:// | ||
+ | # If you experience problems, see http:// | ||
+ | |||
+ | #### MODULES #### | ||
+ | |||
+ | module(load=" | ||
+ | | ||
+ | # local messages are retrieved through imjournal now. | ||
+ | module(load=" | ||
+ | | ||
+ | # | ||
+ | # | ||
+ | |||
+ | # Provides UDP syslog reception | ||
+ | # for parameters see http:// | ||
+ | # | ||
+ | # | ||
+ | |||
+ | # Provides TCP syslog reception | ||
+ | # for parameters see http:// | ||
+ | # | ||
+ | # | ||
+ | |||
+ | #### GLOBAL DIRECTIVES #### | ||
+ | |||
+ | # Where to place auxiliary files | ||
+ | global(workDirectory="/ | ||
+ | |||
+ | # Use default timestamp format | ||
+ | module(load=" | ||
+ | |||
+ | # Include all config files in / | ||
+ | include(file="/ | ||
+ | |||
+ | #### RULES #### | ||
+ | |||
+ | # Log all kernel messages to the console. | ||
+ | # Logging much else clutters up the screen. | ||
+ | # | ||
+ | |||
+ | # Log anything (except mail) of level info or higher. | ||
+ | # Don't log private authentication messages! | ||
+ | *.info; | ||
+ | |||
+ | # The authpriv file has restricted access. | ||
+ | authpriv.* | ||
+ | |||
+ | # Log all the mail messages in one place. | ||
+ | mail.* | ||
+ | |||
+ | |||
+ | # Log cron stuff | ||
+ | cron.* | ||
+ | |||
+ | # Everybody gets emergency messages | ||
+ | *.emerg | ||
+ | |||
+ | # Save news errors of level crit and higher in a special file. | ||
+ | uucp, | ||
+ | |||
+ | # Save boot messages also to boot.log | ||
+ | local7.* | ||
+ | |||
+ | |||
+ | # ### sample forwarding rule ### | ||
+ | # | ||
+ | # An on-disk queue is created for this action. If the remote host is | ||
+ | # down, messages are spooled to disk and sent when it is up again. | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # Remote Logging (we use TCP for reliable delivery) | ||
+ | # remote_host is: name/ip, e.g. 192.168.0.1, | ||
+ | # | ||
+ | </ | ||
+ | |||
+ | Ce fichier est divisé en 3 parties : | ||
+ | |||
+ | * **Modules**, | ||
+ | * Section traitant le chargement des modules offrant des fonctionnalités étendues à rsyslog, | ||
+ | * **Directives Globales** (//Global Directives// | ||
+ | * Section traitant les options de comportement global du service rsyslog, | ||
+ | * **Règles** (// | ||
+ | * Section traitant les règles de configuration des journaux. Les règles au format syslogd gardent le même format. Les nouvelles règles, compatibles seulement avec rsyslog commencent par **module**. | ||
+ | |||
+ | ===Modules=== | ||
+ | |||
+ | Depuis la version 3 de rsyslog, la réception des données par ce dernier appelée les **inputs** est gérée par l' | ||
+ | |||
+ | ^ Module ^ Fonction ^ | ||
+ | | module(load=" | ||
+ | | module(load=" | ||
+ | | module(load=" | ||
+ | | module(load=" | ||
+ | | module(load=" | ||
+ | | module(load=" | ||
+ | |||
+ | Dans le fichier **/ | ||
+ | |||
+ | < | ||
+ | ... | ||
+ | #### MODULES #### | ||
+ | |||
+ | module(load=" | ||
+ | | ||
+ | # local messages are retrieved through imjournal now. | ||
+ | module(load=" | ||
+ | | ||
+ | # | ||
+ | # | ||
+ | |||
+ | # Provides UDP syslog reception | ||
+ | # for parameters see http:// | ||
+ | # | ||
+ | # | ||
+ | |||
+ | # Provides TCP syslog reception | ||
+ | # for parameters see http:// | ||
+ | # | ||
+ | # | ||
+ | ... | ||
+ | </ | ||
+ | |||
+ | Pour activer la réception de messages à partir de serveurs rsyslog distants en utilisant le protocole **UDP**, il convient de décommenter les directives de chargement de modules dans le fichier **/ | ||
+ | |||
+ | < | ||
+ | ... | ||
+ | # Provides UDP syslog reception | ||
+ | # for parameters see http:// | ||
+ | module(load=" | ||
+ | input(type=" | ||
+ | |||
+ | # Provides TCP syslog reception | ||
+ | # for parameters see http:// | ||
+ | module(load=" | ||
+ | input(type=" | ||
+ | ... | ||
+ | </ | ||
+ | |||
+ | <WRAP center round important 60%> | ||
+ | **Important** : Les deux directives **module(load=" | ||
+ | </ | ||
+ | |||
+ | Pour envoyer l' | ||
+ | |||
+ | < | ||
+ | ... | ||
+ | # ### sample forwarding rule ### | ||
+ | # | ||
+ | # An on-disk queue is created for this action. If the remote host is | ||
+ | # down, messages are spooled to disk and sent when it is up again. | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # Remote Logging (we use TCP for reliable delivery) | ||
+ | # remote_host is: name/ip, e.g. 192.168.0.1, | ||
+ | Target=" | ||
+ | ... | ||
+ | </ | ||
+ | |||
+ | <WRAP center round important 60%> | ||
+ | **Important** : Ces directives utilisent le protocole TCP. Le serveur distant doit donc être configuré pour ce mode de communication. La directive **Target=" | ||
+ | </ | ||
+ | |||
+ | ===Directives Globales=== | ||
+ | |||
+ | Les directives dans cette section servent à configurer le comportement de rsyslog. Par exemple, nous pouvons constater la présence de la directive suivante : | ||
+ | |||
+ | < | ||
+ | module(load=" | ||
+ | </ | ||
+ | |||
+ | Cette directive stipule que le format des entrées dans les fichiers de journalisation **ne doit pas** être au format d' | ||
+ | |||
+ | ===Règles=== | ||
+ | |||
+ | Chaque règle prend la forme suivante : | ||
+ | |||
+ | < | ||
+ | Sélecteur[; | ||
+ | </ | ||
+ | |||
+ | Un Sélecteur est défini d'une des façons suivantes : | ||
+ | |||
+ | ==Sous-système applicatif.Priorité== | ||
+ | |||
+ | Dans ce cas on ne tient compte que des messages de priorité égale ou supérieure à la Priorité indiquée. | ||
+ | |||
+ | ==Sous-système applicatif!Priorité== | ||
+ | |||
+ | Dans ce cas on ne tient compte que des messages de priorité inférieure à la Priorité indiquée. | ||
+ | |||
+ | ==Sous-système applicatif=Priorité== | ||
+ | |||
+ | Dans ce cas on ne tient compte que des messages de priorité égale à la Priorité indiquée. | ||
+ | |||
+ | ==L' | ||
+ | |||
+ | La valeur du Sous-système applicatif et/ou de la Priorité peut également être *****. Dans ce cas, toutes les valeurs possibles du **Sous-système applicatif** et/ou de la **Priorité** sont concernées, | ||
+ | |||
+ | ==n Sous-systèmes avec la même priorité== | ||
+ | |||
+ | Plusieurs Sous-systèmes applicatifs peuvent être stipulés pour la même Priorité en les séparant avec un **virgule**. Par exemple : **uucp, | ||
+ | |||
+ | ==n Sélecteurs avec la même Action== | ||
+ | |||
+ | Une Action peut s' | ||
+ | |||
+ | |||
+ | <WRAP center round important 60%> | ||
+ | **Important** : Une Action précédée par le signe **-** est entreprise d'une manière **asynchrone**. Dans le cas ou l' | ||
+ | </ | ||
+ | |||
+ | =====LAB #3 - La Commande logger===== | ||
+ | |||
+ | La commande **/ | ||
+ | |||
+ | La syntaxe de la commande est : | ||
+ | |||
+ | < | ||
+ | logger -p Sous-système applicatif.Priorité message | ||
+ | </ | ||
+ | |||
+ | Par exemple saisissez la commande suivante : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# logger -p user.info Linux est super | ||
+ | </ | ||
+ | |||
+ | Consultez la fin de votre syslog : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# tail / | ||
+ | Jun 3 12:55:01 centos8 systemd[1]: session-237.scope: | ||
+ | Jun 3 12:56:01 centos8 systemd[1]: Started Session 238 of user trainee. | ||
+ | Jun 3 12:56:01 centos8 systemd[1]: session-238.scope: | ||
+ | Jun 3 12:57:01 centos8 systemd[1]: Started Session 239 of user trainee. | ||
+ | Jun 3 12:57:01 centos8 systemd[1]: session-239.scope: | ||
+ | Jun 3 12:58:01 centos8 systemd[1]: Started Session 240 of user trainee. | ||
+ | Jun 3 12:58:01 centos8 systemd[1]: session-240.scope: | ||
+ | Jun 3 12:58:55 centos8 trainee[5139]: | ||
+ | Jun 3 12:59:01 centos8 systemd[1]: Started Session 241 of user trainee. | ||
+ | Jun 3 12:59:01 centos8 systemd[1]: session-241.scope: | ||
+ | </ | ||
+ | |||
+ | Les options de la commande logger sont : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# logger --help | ||
+ | |||
+ | Usage: | ||
+ | | ||
+ | |||
+ | Enter messages into the system log. | ||
+ | |||
+ | Options: | ||
+ | | ||
+ | | ||
+ | -f, --file < | ||
+ | -e, --skip-empty | ||
+ | | ||
+ | -p, --priority < | ||
+ | | ||
+ | | ||
+ | -s, --stderr | ||
+ | -S, --size < | ||
+ | -t, --tag < | ||
+ | -n, --server < | ||
+ | -P, --port < | ||
+ | -T, --tcp use TCP only | ||
+ | -d, --udp use UDP only | ||
+ | | ||
+ | | ||
+ | < | ||
+ | | ||
+ | | ||
+ | | ||
+ | -u, --socket < | ||
+ | | ||
+ | print connection errors when using Unix sockets | ||
+ | | ||
+ | |||
+ | -h, --help | ||
+ | -V, --version | ||
+ | |||
+ | For more details see logger(1). | ||
+ | </ | ||
+ | |||
+ | =====LAB #4 - La Commande logrotate===== | ||
+ | |||
+ | Les fichiers journaux grossissent régulièrement. Le programme **/ | ||
+ | |||
+ | Visualisez le fichier **/ | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# cat / | ||
+ | # see "man logrotate" | ||
+ | # rotate log files weekly | ||
+ | weekly | ||
+ | |||
+ | # keep 4 weeks worth of backlogs | ||
+ | rotate 4 | ||
+ | |||
+ | # create new (empty) log files after rotating old ones | ||
+ | create | ||
+ | |||
+ | # use date as a suffix of the rotated file | ||
+ | dateext | ||
+ | |||
+ | # uncomment this if you want your log files compressed | ||
+ | #compress | ||
+ | |||
+ | # RPM packages drop log rotation information into this directory | ||
+ | include / | ||
+ | |||
+ | # system-specific logs may be also be configured here. | ||
+ | </ | ||
+ | |||
+ | Dans la première partie de ce fichier on trouve des directives pour : | ||
+ | |||
+ | * remplacer les fichiers journaux chaque semaine | ||
+ | * garder 4 archives des fichiers journaux | ||
+ | * créer un nouveau fichier log une fois le précédent archivé | ||
+ | * comprimer les archives créées. | ||
+ | |||
+ | La directive **include / | ||
+ | |||
+ | La deuxième partie du fichier concerne des configurations spécifiques pour certains fichiers journaux. | ||
+ | |||
+ | <WRAP center round important 60%> | ||
+ | **Important** : Notez que la compression des fichiers de journalisation n'est pas activée par défaut. | ||
+ | </ | ||
+ | |||
+ | Les options de la commande logrotate sont : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# logrotate --help | ||
+ | Usage: logrotate [OPTION...] < | ||
+ | -d, --debug | ||
+ | messages | ||
+ | -f, --force | ||
+ | -m, --mail=command | ||
+ | -s, --state=statefile | ||
+ | -v, --verbose | ||
+ | -l, --log=logfile | ||
+ | --version | ||
+ | |||
+ | Help options: | ||
+ | -?, --help | ||
+ | --usage | ||
+ | </ | ||
+ | |||
+ | =====LAB #5 - La Journalisation avec journald===== | ||
+ | |||
+ | Sous RHEL/CentOS 8, les fichiers de Syslog sont gardés pour une question de compatibilité. Cependant, tous les journaux sont d' | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# ls -l / | ||
+ | total 0 | ||
+ | drwxr-s---+ 2 root systemd-journal 60 Jun 3 09:01 de79af4f226d480fa7d3fec4cabbf97a | ||
+ | </ | ||
+ | |||
+ | A l' | ||
+ | |||
+ | Pour rendre les journaux permenants, il faut créer le répertoire **/ | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# mkdir / | ||
+ | [root@centos8 ~]# ls -l / | ||
+ | total 0 | ||
+ | [root@centos8 ~]# systemctl restart systemd-journald | ||
+ | [root@centos8 ~]# ls -l / | ||
+ | ls: cannot access '/ | ||
+ | [root@centos8 ~]# ls -l / | ||
+ | total 0 | ||
+ | drwxr-xr-x. 2 root root 28 Jun 3 13:03 de79af4f226d480fa7d3fec4cabbf97a | ||
+ | </ | ||
+ | |||
+ | Journald ne peut pas envoyer les traces à un autre ordinateur. Pour utiliser un serveur de journalisation distant il faut donc inclure la directive **ForwardToSyslog=yes** dans le fichier de configuration de journald, **/ | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# cat / | ||
+ | # This file is part of systemd. | ||
+ | # | ||
+ | # systemd is free software; you can redistribute it and/or modify it | ||
+ | # under the terms of the GNU Lesser General Public License as published by | ||
+ | # the Free Software Foundation; either version 2.1 of the License, or | ||
+ | # (at your option) any later version. | ||
+ | # | ||
+ | # Entries in this file show the compile time defaults. | ||
+ | # You can change settings by editing this file. | ||
+ | # Defaults can be restored by simply deleting this file. | ||
+ | # | ||
+ | # See journald.conf(5) for details. | ||
+ | |||
+ | [Journal] | ||
+ | # | ||
+ | # | ||
+ | #Seal=yes | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | ForwardToSyslog=yes | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | </ | ||
+ | |||
+ | ====5.1 - Consultation des Journaux==== | ||
+ | |||
+ | L' | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# journalctl | ||
+ | -- Logs begin at Thu 2021-06-03 09:01:10 EDT, end at Thu 2021-06-03 13:08:01 EDT. -- | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: Linux version 4.18.0-240.22.1.el8_3.x86_64 (mockbuild@kbuilder.bsys.centos.org) (gcc version 8.3.1 20191121 (Red Hat 8.3.1-5) (GCC)) #1 SMP Thu Apr 8 19:01:30 UTC 2021 | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: Command line: BOOT_IMAGE=(hd0, | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: x86/fpu: Supporting XSAVE feature 0x001: 'x87 floating point registers' | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: x86/fpu: Supporting XSAVE feature 0x002: 'SSE registers' | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: x86/fpu: Supporting XSAVE feature 0x004: 'AVX registers' | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: x86/fpu: xstate_offset[2]: | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: x86/fpu: Enabled xstate features 0x7, context size is 832 bytes, using ' | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: BIOS-provided physical RAM map: | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: BIOS-e820: [mem 0x0000000000000000-0x000000000009fbff] usable | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: BIOS-e820: [mem 0x000000000009fc00-0x000000000009ffff] reserved | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: BIOS-e820: [mem 0x00000000000f0000-0x00000000000fffff] reserved | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: BIOS-e820: [mem 0x0000000000100000-0x00000000dffeffff] usable | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: BIOS-e820: [mem 0x00000000dfff0000-0x00000000dfffffff] ACPI data | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: BIOS-e820: [mem 0x00000000fec00000-0x00000000fec00fff] reserved | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: BIOS-e820: [mem 0x00000000fee00000-0x00000000fee00fff] reserved | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: BIOS-e820: [mem 0x00000000fffc0000-0x00000000ffffffff] reserved | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: BIOS-e820: [mem 0x0000000100000000-0x000000011fffffff] usable | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: NX (Execute Disable) protection: active | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: SMBIOS 2.5 present. | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: DMI: innotek GmbH VirtualBox/ | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: Hypervisor detected: KVM | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: kvm-clock: Using msrs 4b564d01 and 4b564d00 | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: kvm-clock: cpu 0, msr 114801001, primary cpu clock | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: kvm-clock: using sched offset of 5675771878 cycles | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: clocksource: | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: tsc: Detected 1190.400 MHz processor | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: e820: update [mem 0x00000000-0x00000fff] usable ==> reserved | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: e820: remove [mem 0x000a0000-0x000fffff] usable | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: last_pfn = 0x120000 max_arch_pfn = 0x400000000 | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: MTRR default type: uncachable | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: MTRR variable ranges disabled: | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: Disabled | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: x86/PAT: MTRRs disabled, skipping PAT initialization too. | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: CPU MTRRs all blank - virtualized system. | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: x86/PAT: Configuration [0-7]: WB WT UC- UC WB WT UC- UC | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: last_pfn = 0xdfff0 max_arch_pfn = 0x400000000 | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: found SMP MP-table at [mem 0x0009fff0-0x0009ffff] | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: kexec: Reserving the low 1M of memory for crashkernel | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: BRK [0x114a01000, | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: BRK [0x114a02000, | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: BRK [0x114a03000, | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: BRK [0x114a04000, | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: BRK [0x114a05000, | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: BRK [0x114a06000, | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: BRK [0x114a07000, | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: BRK [0x114a08000, | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: BRK [0x114a09000, | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: RAMDISK: [mem 0x34e00000-0x366f7fff] | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: ACPI: Early table checksum verification disabled | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: ACPI: RSDP 0x00000000000E0000 000024 (v02 VBOX ) | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: ACPI: XSDT 0x00000000DFFF0030 00003C (v01 VBOX | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: ACPI: FACP 0x00000000DFFF00F0 0000F4 (v04 VBOX | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: ACPI: DSDT 0x00000000DFFF0480 002325 (v02 VBOX | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: ACPI: FACS 0x00000000DFFF0200 000040 | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: ACPI: FACS 0x00000000DFFF0200 000040 | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: ACPI: APIC 0x00000000DFFF0240 00006C (v02 VBOX | ||
+ | lines 1-57 | ||
+ | </ | ||
+ | |||
+ | <WRAP center round important 60%> | ||
+ | **Important** : Notez que les messages importants sont en gras, par exemple les messages de niveaux **notice** ou **warning** et que les messages graves sont en rouge. | ||
+ | </ | ||
+ | |||
+ | ====5.2 - Consultation des Journaux d'une Application Spécifique==== | ||
+ | |||
+ | Pour consulter les entrées concernant une application spécifique, | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# journalctl / | ||
+ | -- Logs begin at Thu 2021-06-03 09:01:10 EDT, end at Thu 2021-06-03 13:10:01 EDT. -- | ||
+ | Jun 03 10:01:01 centos8.ittraining.loc anacron[2575]: | ||
+ | Jun 03 10:01:01 centos8.ittraining.loc anacron[2575]: | ||
+ | Jun 03 10:01:01 centos8.ittraining.loc anacron[2575]: | ||
+ | Jun 03 10:16:01 centos8.ittraining.loc anacron[2575]: | ||
+ | Jun 03 10:16:01 centos8.ittraining.loc anacron[2575]: | ||
+ | Jun 03 10:16:01 centos8.ittraining.loc anacron[2575]: | ||
+ | </ | ||
+ | |||
+ | <WRAP center round important 60%> | ||
+ | **Important** : Rappelez-vous que sous RHEL/CentOS 8 le répertoire **/sbin** est un lien symbolique vers **/ | ||
+ | </ | ||
+ | |||
+ | ====5.3 - Consultation des Journaux depuis le Dernier Démarrage==== | ||
+ | |||
+ | Pour consulter les entrées depuis le dernier démarrage, il suffit d' | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# journalctl -b | more | ||
+ | -- Logs begin at Thu 2021-06-03 09:01:10 EDT, end at Thu 2021-06-03 13:11:01 EDT. -- | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: Linux version 4.18.0-240.22.1.el8_3.x86_64 (mockbuild@kbuilder.bsys.centos.org) (gcc version | ||
+ | 8.3.1 20191121 (Red Hat 8.3.1-5) (GCC)) #1 SMP Thu Apr 8 19:01:30 UTC 2021 | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: Command line: BOOT_IMAGE=(hd0, | ||
+ | c-0d59-45be-bd73-d292b80be33c ro crashkernel=auto resume=UUID=c8bb3f47-d67f-4b21-b781-766899dc83d4 rhgb quiet | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: x86/fpu: Supporting XSAVE feature 0x001: 'x87 floating point registers' | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: x86/fpu: Supporting XSAVE feature 0x002: 'SSE registers' | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: x86/fpu: Supporting XSAVE feature 0x004: 'AVX registers' | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: x86/fpu: xstate_offset[2]: | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: x86/fpu: Enabled xstate features 0x7, context size is 832 bytes, using ' | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: BIOS-provided physical RAM map: | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: BIOS-e820: [mem 0x0000000000000000-0x000000000009fbff] usable | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: BIOS-e820: [mem 0x000000000009fc00-0x000000000009ffff] reserved | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: BIOS-e820: [mem 0x00000000000f0000-0x00000000000fffff] reserved | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: BIOS-e820: [mem 0x0000000000100000-0x00000000dffeffff] usable | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: BIOS-e820: [mem 0x00000000dfff0000-0x00000000dfffffff] ACPI data | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: BIOS-e820: [mem 0x00000000fec00000-0x00000000fec00fff] reserved | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: BIOS-e820: [mem 0x00000000fee00000-0x00000000fee00fff] reserved | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: BIOS-e820: [mem 0x00000000fffc0000-0x00000000ffffffff] reserved | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: BIOS-e820: [mem 0x0000000100000000-0x000000011fffffff] usable | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: NX (Execute Disable) protection: active | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: SMBIOS 2.5 present. | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: DMI: innotek GmbH VirtualBox/ | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: Hypervisor detected: KVM | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: kvm-clock: Using msrs 4b564d01 and 4b564d00 | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: kvm-clock: cpu 0, msr 114801001, primary cpu clock | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: kvm-clock: using sched offset of 5675771878 cycles | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: clocksource: | ||
+ | 590591483 ns | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: tsc: Detected 1190.400 MHz processor | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: e820: update [mem 0x00000000-0x00000fff] usable ==> reserved | ||
+ | --More-- | ||
+ | </ | ||
+ | |||
+ | <WRAP center round important 60%> | ||
+ | **Important** : Notez que vous pouvez consulter les messages des démarrages précédents, | ||
+ | </ | ||
+ | |||
+ | ====5.4 - Consultation des Journaux d'une Priorité Spécifique==== | ||
+ | |||
+ | Pour consulter les entrées à partir d'une priorité spécifique et supérieur, il suffit d' | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# journalctl -p warning | ||
+ | -- Logs begin at Thu 2021-06-03 09:01:10 EDT, end at Thu 2021-06-03 13:12:01 EDT. -- | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: | ||
+ | Jun 03 09:01:10 centos8.ittraining.loc kernel: acpi PNP0A03:00: fail to add MMCONFIG information, | ||
+ | Jun 03 09:01:12 centos8.ittraining.loc kernel: e1000: E1000 MODULE IS NOT SUPPORTED | ||
+ | Jun 03 09:01:12 centos8.ittraining.loc kernel: [drm: | ||
+ | Jun 03 09:01:12 centos8.ittraining.loc kernel: [drm: | ||
+ | Jun 03 09:01:18 centos8.ittraining.loc kernel: printk: systemd: 19 output lines suppressed due to ratelimiting | ||
+ | Jun 03 09:01:20 centos8.ittraining.loc firewalld[874]: | ||
+ | Jun 03 09:01:21 centos8.ittraining.loc systemd[1]: iscsi.service: | ||
+ | Jun 03 09:01:24 centos8.ittraining.loc systemd[1]: iscsi.service: | ||
+ | Jun 03 09:01:24 centos8.ittraining.loc systemd[1]: iscsi.service: | ||
+ | Jun 03 09:01:26 centos8.ittraining.loc chronyd[850]: | ||
+ | Jun 03 09:01:28 centos8.ittraining.loc chronyd[850]: | ||
+ | Jun 03 12:46:31 centos8.ittraining.loc chronyd[850]: | ||
+ | lines 1-15/15 (END) | ||
+ | </ | ||
+ | |||
+ | Les priorités reconnues par Journald sont : | ||
+ | |||
+ | ^ Niveau ^ Priorité ^ Description ^ | ||
+ | | 0 | emerg | Système inutilisable | | ||
+ | | 1 | alert | Action immédiate requise | | ||
+ | | 2 | crit | Condition critique atteinte | | ||
+ | | 3 | err | Erreurs rencontrées | | ||
+ | | 4 | warning | Avertissements présentés | | ||
+ | | 5 | notice | Condition normale - message important | | ||
+ | | 6 | info | Condition normale - message simple | | ||
+ | | 7 | debug | Condition normale - message de débogage | | ||
+ | |||
+ | ====5.5 - Consultation des Journaux d'une Plage de Dates ou d' | ||
+ | |||
+ | Pour consulter les entrées d'une plage de dates ou d' | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# journalctl --since 12:00 --until now | ||
+ | -- Logs begin at Thu 2021-06-03 09:01:10 EDT, end at Thu 2021-06-03 13:14:01 EDT. -- | ||
+ | Jun 03 12:00:01 centos8.ittraining.loc systemd[1]: Started Session 181 of user trainee. | ||
+ | Jun 03 12:00:01 centos8.ittraining.loc CROND[4238]: | ||
+ | Jun 03 12:00:01 centos8.ittraining.loc systemd[1]: session-181.scope: | ||
+ | Jun 03 12:01:01 centos8.ittraining.loc CROND[4251]: | ||
+ | Jun 03 12:01:01 centos8.ittraining.loc systemd[1]: Started Session 182 of user trainee. | ||
+ | Jun 03 12:01:01 centos8.ittraining.loc run-parts[4255]: | ||
+ | Jun 03 12:01:01 centos8.ittraining.loc CROND[4260]: | ||
+ | Jun 03 12:01:01 centos8.ittraining.loc run-parts[4262]: | ||
+ | Jun 03 12:01:01 centos8.ittraining.loc systemd[1]: session-182.scope: | ||
+ | Jun 03 12:02:01 centos8.ittraining.loc systemd[1]: Started Session 183 of user trainee. | ||
+ | Jun 03 12:02:01 centos8.ittraining.loc CROND[4275]: | ||
+ | Jun 03 12:02:01 centos8.ittraining.loc systemd[1]: session-183.scope: | ||
+ | Jun 03 12:03:01 centos8.ittraining.loc systemd[1]: Started Session 184 of user trainee. | ||
+ | Jun 03 12:03:01 centos8.ittraining.loc CROND[4289]: | ||
+ | Jun 03 12:03:01 centos8.ittraining.loc systemd[1]: session-184.scope: | ||
+ | Jun 03 12:04:01 centos8.ittraining.loc systemd[1]: Started Session 185 of user trainee. | ||
+ | Jun 03 12:04:01 centos8.ittraining.loc CROND[4303]: | ||
+ | Jun 03 12:04:01 centos8.ittraining.loc systemd[1]: session-185.scope: | ||
+ | Jun 03 12:05:01 centos8.ittraining.loc systemd[1]: Started Session 186 of user trainee. | ||
+ | Jun 03 12:05:01 centos8.ittraining.loc CROND[4319]: | ||
+ | Jun 03 12:05:01 centos8.ittraining.loc systemd[1]: session-186.scope: | ||
+ | Jun 03 12:06:02 centos8.ittraining.loc systemd[1]: Started Session 187 of user trainee. | ||
+ | Jun 03 12:06:02 centos8.ittraining.loc CROND[4332]: | ||
+ | Jun 03 12:06:02 centos8.ittraining.loc systemd[1]: session-187.scope: | ||
+ | Jun 03 12:07:01 centos8.ittraining.loc systemd[1]: Started Session 188 of user trainee. | ||
+ | Jun 03 12:07:01 centos8.ittraining.loc CROND[4346]: | ||
+ | Jun 03 12:07:01 centos8.ittraining.loc systemd[1]: session-188.scope: | ||
+ | Jun 03 12:08:01 centos8.ittraining.loc systemd[1]: Started Session 189 of user trainee. | ||
+ | Jun 03 12:08:01 centos8.ittraining.loc CROND[4360]: | ||
+ | Jun 03 12:08:01 centos8.ittraining.loc systemd[1]: session-189.scope: | ||
+ | lines 1-31 | ||
+ | </ | ||
+ | |||
+ | <WRAP center round important 60%> | ||
+ | **Important** : Il est possible d' | ||
+ | </ | ||
+ | |||
+ | ====5.6 - Consultation des Journaux en Live==== | ||
+ | |||
+ | Pour consulter les journaux en live, il suffit d' | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# journalctl -f | ||
+ | -- Logs begin at Thu 2021-06-03 09:01:10 EDT. -- | ||
+ | Jun 03 13:13:08 centos8.ittraining.loc systemd[1]: Started dnf makecache. | ||
+ | Jun 03 13:14:01 centos8.ittraining.loc systemd[1]: Started Session 256 of user trainee. | ||
+ | Jun 03 13:14:01 centos8.ittraining.loc CROND[5391]: | ||
+ | Jun 03 13:14:01 centos8.ittraining.loc systemd[1]: session-256.scope: | ||
+ | Jun 03 13:15:01 centos8.ittraining.loc systemd[1]: Started Session 257 of user trainee. | ||
+ | Jun 03 13:15:01 centos8.ittraining.loc CROND[5407]: | ||
+ | Jun 03 13:15:01 centos8.ittraining.loc systemd[1]: session-257.scope: | ||
+ | Jun 03 13:16:02 centos8.ittraining.loc systemd[1]: Started Session 258 of user trainee. | ||
+ | Jun 03 13:16:02 centos8.ittraining.loc CROND[5420]: | ||
+ | Jun 03 13:16:02 centos8.ittraining.loc systemd[1]: session-258.scope: | ||
+ | ^C | ||
+ | </ | ||
+ | |||
+ | Ouvrez un deuxième terminal et saisissez la commande suivante : | ||
+ | |||
+ | < | ||
+ | [trainee@centos8 ~]$ logger -p user.info Linux est super | ||
+ | </ | ||
+ | |||
+ | Retournez consulter le premier terminal : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# journalctl -f | ||
+ | -- Logs begin at Thu 2021-06-03 09:01:10 EDT. -- | ||
+ | Jun 03 13:13:08 centos8.ittraining.loc systemd[1]: Started dnf makecache. | ||
+ | Jun 03 13:14:01 centos8.ittraining.loc systemd[1]: Started Session 256 of user trainee. | ||
+ | Jun 03 13:14:01 centos8.ittraining.loc CROND[5391]: | ||
+ | Jun 03 13:14:01 centos8.ittraining.loc systemd[1]: session-256.scope: | ||
+ | Jun 03 13:15:01 centos8.ittraining.loc systemd[1]: Started Session 257 of user trainee. | ||
+ | Jun 03 13:15:01 centos8.ittraining.loc CROND[5407]: | ||
+ | Jun 03 13:15:01 centos8.ittraining.loc systemd[1]: session-257.scope: | ||
+ | Jun 03 13:16:02 centos8.ittraining.loc systemd[1]: Started Session 258 of user trainee. | ||
+ | Jun 03 13:16:02 centos8.ittraining.loc CROND[5420]: | ||
+ | Jun 03 13:16:02 centos8.ittraining.loc systemd[1]: session-258.scope: | ||
+ | Jun 03 13:17:01 centos8.ittraining.loc systemd[1]: Started Session 259 of user trainee. | ||
+ | Jun 03 13:17:01 centos8.ittraining.loc CROND[5436]: | ||
+ | Jun 03 13:17:01 centos8.ittraining.loc systemd[1]: session-259.scope: | ||
+ | Jun 03 13:17:19 centos8.ittraining.loc sshd[5439]: Accepted password for trainee from 10.0.2.2 port 39906 ssh2 | ||
+ | Jun 03 13:17:19 centos8.ittraining.loc systemd-logind[880]: | ||
+ | Jun 03 13:17:19 centos8.ittraining.loc systemd[1]: Started Session 260 of user trainee. | ||
+ | Jun 03 13:17:19 centos8.ittraining.loc sshd[5439]: pam_unix(sshd: | ||
+ | Jun 03 13:17:34 centos8.ittraining.loc trainee[5470]: | ||
+ | Jun 03 13:17:34 centos8.ittraining.loc rsyslogd[1113]: | ||
+ | Jun 03 13:18:01 centos8.ittraining.loc systemd[1]: Started Session 261 of user trainee. | ||
+ | Jun 03 13:18:01 centos8.ittraining.loc CROND[5481]: | ||
+ | Jun 03 13:18:01 centos8.ittraining.loc systemd[1]: session-261.scope: | ||
+ | ^C | ||
+ | </ | ||
+ | |||
+ | <WRAP center round important 60%> | ||
+ | **Important** : Notez la présence de la ligne **Jun 03 13:17:34 centos8.ittraining.loc trainee[5470]: | ||
+ | </ | ||
+ | |||
+ | ====5.7 - Consultation des Journaux avec des Mots Clefs=== | ||
+ | |||
+ | Pour consulter les mots clefs compris par Journald, tapez la commande **journalctl** puis appuyer **deux** fois sur la touche < | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# journalctl [tab] [tab] | ||
+ | _AUDIT_LOGINUID= | ||
+ | _AUDIT_SESSION= | ||
+ | AVAILABLE= | ||
+ | AVAILABLE_PRETTY= | ||
+ | _BOOT_ID= | ||
+ | _CAP_EFFECTIVE= | ||
+ | _CMDLINE= | ||
+ | CODE_FILE= | ||
+ | CODE_FUNC= | ||
+ | CODE_LINE= | ||
+ | _COMM= | ||
+ | CURRENT_USE= | ||
+ | CURRENT_USE_PRETTY= | ||
+ | DISK_AVAILABLE= | ||
+ | DISK_AVAILABLE_PRETTY= | ||
+ | DISK_KEEP_FREE= | ||
+ | DISK_KEEP_FREE_PRETTY= | ||
+ | _EXE= | ||
+ | _GID= | ||
+ | </ | ||
+ | |||
+ | Pour voir la liste des processus dont les traces sont inclus dans les journaux du mots clefs, tapez la commande journalctl suivi par le nom d'un mot clef puis appuyer deux fois sur la touche < | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# journalctl _UID= | ||
+ | 0 | ||
+ | [root@centos8 ~]# journalctl _COMM= | ||
+ | anacron | ||
+ | auditd | ||
+ | augenrules | ||
+ | chronyd | ||
+ | crond firewalld | ||
+ | </ | ||
+ | |||
+ | ----- | ||
+ | Copyright © 2024 Hugh Norris. |