Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Prochaine révision
Révision précédente
elearning:workbooks:redhat:rh124:l109 [2024/09/25 08:03] – created adminelearning:workbooks:redhat:rh124:l109 [2024/09/27 13:05] (Version actuelle) admin
Ligne 5: Ligne 5:
 Dernière mise-à-jour : ~~LASTMOD~~ Dernière mise-à-jour : ~~LASTMOD~~
  
-======LCF508 - Gestion de la Journalisation======+======RH12410 - Gestion des Processus======
  
 =====Contenu du Module===== =====Contenu du Module=====
  
-  * **LCF508 - Gestion de la Journalisation**+  * **RH12410 - Gestion des Processus** 
 +    * Contenu du Module
     * Présentation     * Présentation
-    * La Commande dmesg +    * Les Types de Processus 
-    * LAB #1 - Surveillance Sécuritaire +    * LAB #1 - Les Commandes relatives aux Processus 
-      * 1.1 - La Commande last +      * 1.1 - La Commande ps 
-      * 1.2 - La Commande lastlog +      * 1.2 - La Commande pgrep 
-      * 1.3 - La Commande lastb +      * 1.3 - La Commande pstree 
-      * 1.4 - Le Fichier /var/log/secure +      * 1.4 - La Commande top 
-      * 1.5 - Gestion des évènements audit +      * 1.5 - Les Commandes fg, bg et jobs 
-        Le fichier /var/log/audit/audit.log +      1.6 - La Commande wait 
-        * auditd +      * 1.La Commande nice 
-        * auditctl +      * 1.- La Commande renice 
-        * audispd +      1.9 - La Commande nohup 
-        * La consultation des événements audit +      * 1.10 La Commande kill 
-          * La Commande aureport +      * 1.11 La Commande pkill
-          * La Commande ausearch +
-    * Le fichier /var/log/messages +
-    * Applications +
-    * LAB #2 - rsyslog +
-      * 2.- Priorités +
-      * 2.Sous-systèmes applicatifs +
-      * 2.3 - /etc/rsyslog.conf +
-        * Modules +
-        * Directives Globales +
-        * Règles +
-          * Sous-système applicatif.Priorité +
-          * Sous-système applicatif!Priorité +
-          * Sous-système applicatif=Priorité +
-          * L'utilisation du caractère spécial * +
-          * 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.- Consultation des Journaux +
-      * 5.Consultation des Journaux d'une Application Spécifique +
-      * 5.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'Heures +
-      * 5.6 - Consultation des Journaux en Live +
-      * 5.7 - Consultation des Journaux avec des Mots Clefs+
  
 =====Présentation===== =====Présentation=====
  
-La majorité des journaux du système et des applications se trouve dans le répertoire **/var/log**.+Un processus est un fichier binaire ( binary file ) qui est chargé en mémoire centrale. Une fois chargé la mémoire exécute le programme en langage machine. Quand le programme est chargé, il a besoin du système d’exploitation qui lui fournit des informations pour qu’il puisse s’exécuter correctement. Ces informations sont appelées des **données d’identification**. 
  
-<WRAP center round important 60%> +L’ensemble des **données d’identification** est appelé l’**environnement de processus** 
-**Important** : Il est conseillé de déplacer le point de montage du répertoire **/var/log** sur une partition physique ou un volume logique à part. De cette façonen cas de journalisation rapide trop bavarde la limite de la taille de ce répertoire est celle de la taille de la partition physique ou du volume logique. Si vous laissez ce répertoire dans la racine du systèmeil existe un risque à ce que les journaux grossissent si vite qu'ils occupent toute l'espace disque libre, créant ainsi un crash système. + 
-</WRAP>+  Un numéro de processus unique (PID), 
 +  Un numéro de processus parent (PPID), 
 +  * Un numéro d'utilisateur (UID), 
 +  * Un numéro de groupe (GID), 
 +  * La durée de traitement, 
 +  * La priorité du processus, 
 +  * Le répertoire de travail actif, 
 +  * Les fichiers ouverts.
  
-=====La Commande /bin/dmesg=====+Ces informations sont stockés dans le répertoire **/proc**. Le répertoire /proc contient des fichiers et des répertoires virtuels. Le contenu de ces fichiers est créé dynamiquement lors de la consultation. Seul root peut consulter la totalité des informations dans le répertoire /proc. 
  
-Cette commande retourne les messages du noyau (**//Kernel Ring Buffer//**) stockés dans le fichier **/var/log/dmesg** lors du dernier démarrage du système :+Saisissez la commande suivante :
  
 <code> <code>
-[root@centos8 ~]# dmesg | more +[root@redhat9 ~]# cd /proc; ls -d [0-9]* 
-   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 +     10446  10597  17    22   28  34   406  423  465  504  535  540  5671  5705  5724  5737  5765  5950  6     6200  6384  6444  6462  6571  6668  708  7429  76    77    79    8946  9400 
-CC)) #SMP Thu Apr 8 19:01:30 UTC 2021 +10     10590  12     18    23   29  35   415  43   47   51   536  541  5675  5707  5725  5742  5787  5952  6049  6206  6410  6451  6473  6599  6674  709  743   7618  78    7900  90    9490 
-   0.000000] Command line: BOOT_IMAGE=(hd0,msdos1)/vmlinuz-4.18.0-240.22.1.el8_3.x86_64 root=UUID=4c0cc28c-0d59-45be-bd73-d292b80be33c ro cra +10062  10591  13         24     36   42   434  48   511  537  542  5698  5708  5728  5743  58    5956  61    629   6432  6452  6477  6611  69    710  7430  7619  7896  8     9357  95 
-shkernel=auto resume=UUID=c8bb3f47-d67f-4b21-b781-766899dc83d4 rhgb quiet +10066  10592  14     20    242  30  38   420  44   49   52   538  543  57    5710  5734  5744  5851  5963  614   6318  6433  6453  6479  6617  705   711  7431  7620  7897  80    9365  9543 
-   0.000000] x86/fpu: Supporting XSAVE feature 0x001: 'x87 floating point registers' +10223  10595  15     2014  245  32  4    421  45      53   539  55   5700  5714  5735  5757  5863  5968  6195  6377  6436  6454  6482  6626  706   712  7432  7621  7898  81    9369  96 
-   0.000000] x86/fpu: Supporting XSAVE feature 0x002: 'SSE registers' +10383  10596  16     21    27   33  403  422  46   50   534  54   56   5704  5717  5736  5763  59    5975  62    6381  6439  6455  6486  6640  707   742  7433  7622  7899  853   9392  9896
-   0.000000] x86/fpu: Supporting XSAVE feature 0x004: 'AVX registers' +
-   0.000000] x86/fpu: xstate_offset[2]:  576, xstate_sizes[2]:  256 +
-   0.000000] x86/fpu: Enabled xstate features 0x7, context size is 832 bytes, using 'standard' format. +
-   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/VirtualBox, BIOS VirtualBox 12/01/2006 +
-[    0.000000] Hypervisor detected: KVM +
---More--+
 </code> </code>
  
-Les option de cette commande sont :+Chaque répertoire fait référence à un PID d'un processus. Les données de l’**environnement de processus** y sont présentes, par exemple :
  
 <code> <code>
-[root@centos8 ~]# dmesg --help+[root@redhat9 proc]# cd 1 ; ls -
 +total 0 
 +-r--r--r--.  1 root root 0 Sep 25 15:29 arch_status 
 +dr-xr-xr-x.  2 root root 0 Sep 25 12:44 attr 
 +-rw-r--r--.  1 root root 0 Sep 25 15:29 autogroup 
 +-r--------.  1 root root 0 Sep 25 15:29 auxv 
 +-r--r--r--.  1 root root 0 Sep 25 12:44 cgroup 
 +--w-------.  1 root root 0 Sep 25 15:29 clear_refs 
 +-r--r--r--.  1 root root 0 Sep 25 12:44 cmdline 
 +-rw-r--r--.  1 root root 0 Sep 25 12:44 comm 
 +-rw-r--r--.  1 root root 0 Sep 25 15:29 coredump_filter 
 +-r--r--r--.  1 root root 0 Sep 25 15:29 cpu_resctrl_groups 
 +-r--r--r--.  1 root root 0 Sep 25 15:29 cpuset 
 +lrwxrwxrwx.  1 root root 0 Sep 25 14:56 cwd -> / 
 +-r--------.  1 root root 0 Sep 25 12:44 environ 
 +lrwxrwxrwx.  1 root root 0 Sep 25 12:44 exe -> /usr/lib/systemd/systemd 
 +dr-x------.  2 root root 0 Sep 25 12:44 fd 
 +dr-xr-xr-x.  2 root root 0 Sep 25 14:56 fdinfo 
 +-rw-r--r--.  1 root root 0 Sep 25 12:44 gid_map 
 +-r--------.  1 root root 0 Sep 25 15:29 io 
 +-r--------.  1 root root 0 Sep 25 15:29 ksm_merging_pages 
 +-r--r--r--.  1 root root 0 Sep 25 15:29 limits 
 +-rw-r--r--.  1 root root 0 Sep 25 12:44 loginuid 
 +dr-x------.  2 root root 0 Sep 25 15:29 map_files 
 +-r--r--r--.  1 root root 0 Sep 25 12:44 maps 
 +-rw-------.  1 root root 0 Sep 25 15:29 mem 
 +-r--r--r--.  1 root root 0 Sep 25 12:44 mountinfo 
 +-r--r--r--.  1 root root 0 Sep 25 12:44 mounts 
 +-r--------.  1 root root 0 Sep 25 15:29 mountstats 
 +dr-xr-xr-x. 53 root root 0 Sep 25 12:44 net 
 +dr-x--x--x.  2 root root 0 Sep 25 12:44 ns 
 +-r--r--r--.  1 root root 0 Sep 25 15:29 numa_maps 
 +-rw-r--r--.  1 root root 0 Sep 25 15:29 oom_adj 
 +-r--r--r--.  1 root root 0 Sep 25 15:29 oom_score 
 +-rw-r--r--.  1 root root 0 Sep 25 15:29 oom_score_adj 
 +-r--------.  1 root root 0 Sep 25 15:29 pagemap 
 +-r--------.  1 root root 0 Sep 25 15:29 patch_state 
 +-r--------.  1 root root 0 Sep 25 15:29 personality 
 +-rw-r--r--.  1 root root 0 Sep 25 15:29 projid_map 
 +lrwxrwxrwx.  1 root root 0 Sep 25 12:44 root -> / 
 +-rw-r--r--.  1 root root 0 Sep 25 15:29 sched 
 +-r--r--r--.  1 root root 0 Sep 25 15:29 schedstat 
 +-r--r--r--.  1 root root 0 Sep 25 12:44 sessionid 
 +-rw-r--r--.  1 root root 0 Sep 25 12:44 setgroups 
 +-r--r--r--.  1 root root 0 Sep 25 15:29 smaps 
 +-r--r--r--.  1 root root 0 Sep 25 15:29 smaps_rollup 
 +-r--------.  1 root root 0 Sep 25 15:29 stack 
 +-r--r--r--.  1 root root 0 Sep 25 14:56 stat 
 +-r--r--r--.  1 root root 0 Sep 25 15:29 statm 
 +-r--r--r--.  1 root root 0 Sep 25 12:44 status 
 +-r--------.  1 root root 0 Sep 25 15:29 syscall 
 +dr-xr-xr-x.  3 root root 0 Sep 25 12:44 task 
 +-rw-r--r--.  1 root root 0 Sep 25 15:29 timens_offsets 
 +-r--r--r--.  1 root root 0 Sep 25 15:29 timers 
 +-rw-rw-rw-.  1 root root 0 Sep 25 15:29 timerslack_ns 
 +-rw-r--r--.  1 root root 0 Sep 25 12:44 uid_map 
 +-r--r--r--.  1 root root 0 Sep 25 15:29 wchan 
 +</code>
  
-Usage: +<WRAP center round important> 
- dmesg [options]+**Important** - Vous n'avez pas besoin de consulter le contenu des fichiers et des répertoires. Il convient tout simplement de savoir que ces données existent. 
 +</WRAP>
  
-Display or control the kernel ring buffer.+=====Les Types de Processus=====
  
-Options: +Il existe trois types de processus :
- -C, --clear                 clear the kernel ring buffer +
- -c, --read-clear            read and clear all messages +
- -D, --console-off           disable printing messages to console +
- -E, --console-on            enable printing messages to console +
- -F, --file <file>           use the file instead of the kernel log buffer +
- -f, --facility <list>       restrict output to defined facilities +
- -H, --human                 human readable output +
- -k, --kernel                display kernel messages +
- -L, --color[=<when>       colorize messages (auto, always or never) +
-                               colors are enabled by default +
- -l, --level <list>          restrict output to defined levels +
- -n, --console-level <level> set level of messages printed to console +
- -P, --nopager               do not pipe output into a pager +
- -p, --force-prefix          force timestamp output on each line of multi-line messages +
- -r, --raw                   print the raw message buffer +
- -S, --syslog                force to use syslog(2) rather than /dev/kmsg +
- -s, --buffer-size <size>    buffer size to query the kernel ring buffer +
- -u, --userspace             display userspace messages +
- -w, --follow                wait for new messages +
- -x, --decode                decode facility and level to readable string +
- -d, --show-delta            show time delta between printed messages +
- -e, --reltime               show local time and time delta in readable format +
- -T, --ctime                 show human-readable timestamp (may be inaccurate!) +
- -t, --notime                don't show any timestamp with messages +
-     --time-format <format>  show timestamp using the given format: +
-                               [delta|reltime|ctime|notime|iso] +
-Suspending/resume will make ctime and iso timestamps inaccurate.+
  
- -h, --help                  display this help +  * **interactif** qui est lancé par le shell dans une console en premier plan ou en tâche de fond 
- -V--version               display version+  * **batch** qui est lancé par le système au moment propice 
 +  * **daemon** qui est lancé au démarrage par le système ( lpddns etc )
  
-Supported log facilities: +Un processus peut être dans un de neuf états ou //process states// :
-    kern - kernel messages +
-    user - random user-level messages +
-    mail - mail system +
-  daemon - system daemons +
-    auth - security/authorization messages +
-  syslog - messages generated internally by syslogd +
-     lpr - line printer subsystem +
-    news - network news subsystem+
  
-Supported log levels (priorities): +  * //user mode// le processus s'exécute en mode utilisateur, 
-   emerg system is unusable +  * //kernel mode//le processus s'exécute en mode noyau,  
-   alert action must be taken immediately +  * //new// le processus est nouveau, 
-    crit critical conditions +  * //waiting// – le processus est en attente pour une ressource autre que le processeur, 
-     err - error conditions +  * //sleeping// le processus est endormi, 
-    warn warning conditions +  * //swap// le processus est endormi dans la mémoire virtuelle, 
-  notice normal but significant condition +  * //runnable// – le processus dispose de toutes le ressources nécessaire à son exécution sauf le processeur, 
-    info - informational +  * //elected// – le processus a le contrôle du processeur, 
-   debug - debug-level messages+  * //zombie// – le processus a terminé son exécution et est prêt à mourir.
  
-For more details see dmesg(1). +=====LAB #- Les Commandes relatives aux Processus=====
-</code>+
  
-=====LAB #1 - Surveillance Sécuritaire=====+====1.1 - La Commande ps====
  
-====1.1 - La Commande last==== +Cette commande affiche les processus de l’utilisateur attaché au terminal :
- +
-Cette commande indique les dates et heures des connexions des utilisateurs à partir du contenu du fichier **/var/log/wtmp** :+
  
 <code> <code>
-[root@centos8 ~]# last +[root@redhat9 1]# cd ~
-trainee  pts/0        10.0.2.2         Thu Jun  3 09:01   still logged in +
-reboot   system boot  4.18.0-240.22.1. Thu Jun  3 09:01   still running +
-trainee  pts/0        10.0.2.2         Wed Jun  2 12:07 - crash  (20:54) +
-trainee  pts/0        10.0.2.2         Wed Jun  2 11:16 - 12:06  (00:50) +
-reboot   system boot  4.18.0-240.22.1. Wed Jun  2 11:12   still running +
-trainee  pts/0        10.0.2.2         Wed Jun  2 11:13 - 11:14  (00:01) +
-reboot   system boot  4.18.0-240.22.1. Wed Jun  2 11:10 - 11:14  (00:04) +
-trainee  pts/0        10.0.2.2         Wed Jun  2 11:08 - 11:12  (00:04) +
-reboot   system boot  4.18.0-240.22.1. Wed Jun  2 11:04 - 11:12  (00:07) +
-trainee  pts/0        10.0.2.2         Wed Jun  2 06:40 - 11:06  (04:26) +
-trainee  pts/0        10.0.2.2         Wed Jun  2 06:39 - 06:39  (00:00) +
-reboot   system boot  4.18.0-240.22.1. Wed Jun  2 06:07 - 11:07  (04:59) +
-trainee  pts/1        10.0.2.2         Wed May 26 16:51 - crash (6+13:15) +
-trainee  pts/0        10.0.2.2         Wed May 26 10:37 - 18:50  (08:13) +
-trainee  pts/0        10.0.2.2         Wed May 26 08:48 - 10:36  (01:48) +
-trainee  tty1                          Wed May 26 08:47 - crash (6+21:19) +
-reboot   system boot  4.18.0-240.22.1. Wed May 26 08:44 - 11:07 (7+02:22) +
-trainee  pts/0        10.0.2.2         Wed Apr 21 07:23 - 19:14  (11:51) +
-trainee  pts/0        10.0.2.2         Tue Apr 20 23:13 - 07:22  (08:08) +
-trainee  pts/1                         Tue Apr 20 10:59 - 11:00  (00:00) +
-trainee  pts/0        10.0.2.2         Tue Apr 20 09:59 - 23:13  (13:13) +
-trainee  pts/1        10.0.2.2         Tue Apr 20 04:10 - 04:29  (00:19) +
-trainee  pts/0        10.0.2.2         Tue Apr 20 02:21 - 09:57  (07:36) +
-trainee  tty1                          Tue Apr 20 02:17 - crash (36+06:26) +
-trainee  pts/0        10.0.2.2         Mon Apr 19 13:55 - 02:17  (12:22) +
-trainee  pts/0        10.0.2.2         Mon Apr 19 12:05 - 13:47  (01:42) +
-reboot   system boot  4.18.0-240.22.1. Mon Apr 19 12:05 - 11:07 (43+23:01) +
-trainee  pts/0        10.0.2.2         Mon Apr 19 11:40 - crash  (00:24) +
-reboot   system boot  4.18.0-147.8.1.e Mon Apr 19 11:37 - 11:07 (43+23:29) +
-trainee  pts/0        10.0.2.2         Tue Sep  1 09:59 - 11:10  (01:10) +
-reboot   system boot  4.18.0-147.8.1.e Tue Sep  1 09:58 - 11:10  (01:11) +
-reboot   system boot  4.18.0-147.8.1.e Fri May  8 08:13 - 11:10 (116+02:56)+
  
-wtmp begins Fri May  8 08:13:49 2020+[root@redhat9 ~]# ps 
 +    PID TTY          TIME CMD 
 +  10062 pts/0    00:00:00 su 
 +  10066 pts/0    00:00:00 bash 
 +  10602 pts/0    00:00:00 ps
 </code> </code>
  
-Les option de cette commande sont :+Pour plus de détails, il convient d'utiliser l'option **-l** :
  
 <code> <code>
-[root@centos8 ~]# last --help+[root@redhat9 ~]# ps -
 +F S   UID     PID    PPID  C PRI  NI ADDR SZ WCHAN  TTY          TIME CMD 
 +4 S       10062    9400  0  80   58719 do_wai pts/0    00:00:00 su 
 +4 S       10066   10062  0  80   0 - 56056 do_wai pts/0    00:00:00 bash 
 +4 R       10604   10066  0  80   0 - 56370 -      pts/0    00:00:00 ps 
 +</code>
  
-Usage: +On note dans cette sortie :
- last [options] [<username>...] [<tty>...]+
  
-Show a listing of last logged in users.+^ F | Drapeaux du processusLa valeur 4 indique que le processus utilise les privilèges de root | 
 +^ S | État du processus S (sleeping), R (In run queue), Z (zombie), N (low priority), D (uninterruptible sleep), T (Traced) | 
 +^ UID | Numéro de l’Utilisateur | 
 +^ PID | Numéro Unique de Processus | 
 +^ PPID | PID du processus parent | 
 +^ C | Facteur de priorité du processus | 
 +^ PRI | Priorité du processus | 
 +^ NI | La valeur de nice | 
 +^ ADDR | Adresse mémoire du processus | 
 +^ SZ | Utilisation de la mémoire virtuelle | 
 +^ WCHAN | Nom de la fonction du noyau dans laquelle le processus est endormi | 
 +^ TTY | Nom du terminal depuis lequel le processus a été lancé | 
 +^ TIME | Durée d'exécution du processus | 
 +^ CMD | Commande exécutée |
  
-Options: +Pour visualiser la table des processusutilisez la commande ps avec les options l et x - la commande affiche tous les processus avec un affichage long :
- -<number>            how many lines to show +
- -a--hostlast       display hostnames in the last column +
- -d, --dns            translate the IP number back into a hostname +
- -f, --file <file>    use a specific file instead of /var/log/wtmp +
- -F, --fulltimes      print full login and logout times and dates +
- -i, --ip             display IP numbers in numbers-and-dots notation +
- -n, --limit <number> how many lines to show +
- -R, --nohostname     don't display the hostname field +
- -s, --since <time>   display the lines since the specified time +
- -t, --until <time>   display the lines until the specified time +
- -p, --present <time> display who were present at the specified time +
- -w, --fullnames      display full user and domain names +
- -x, --system         display system shutdown entries and run level changes +
-     --time-format <format>  show timestamps in the specified <format>: +
-                               notime|short|full|iso+
  
- -h, --help           display this help +<code> 
- -V, --version        display version +[root@redhat9 ~]# ps lx | more 
- +F   UID     PID    PPID PRI  NI    VSZ   RSS WCHAN  STAT TTY        TIME COMMAND 
-For more details see last(1).+4                  20   0 190992 17880 ep_pol Ss   ?          0:13 /usr/lib/systemd/systemd rhgb --switched-root --system --deserialize 31 
 +1                  20        0     0 kthrea S    ?          0:00 [kthreadd] 
 +1                   -20      0     0 rescue I<   ?          0:00 [rcu_gp] 
 +1                   -20      0     0 rescue I<   ?          0:00 [rcu_par_gp] 
 +1                   -20      0     0 rescue I<   ?          0:00 [slub_flushwq] 
 +1                   0 -20      0     0 rescue I<   ?          0:00 [netns] 
 +    0               0 -20      0     0 worker I<   ?          0:00 [kworker/0:0H-events_highpri] 
 +1          10         0 -20      0     0 rescue I<   ?          0:00 [mm_percpu_wq] 
 +1          12        20        0     0 rcu_ta I    ?          0:00 [rcu_tasks_kthre] 
 +1          13        20        0     0 rcu_ta I    ?          0:00 [rcu_tasks_rude_] 
 +1          14        20        0     0 rcu_ta I    ?          0:00 [rcu_tasks_trace] 
 +1          15        20        0     0 smpboo S    ?          0:00 [ksoftirqd/0] 
 +1          16        20        0     0 rcu_gp I    ?          0:01 [rcu_preempt] 
 +1          17       2 -100  -      0     0 smpboo S    ?          0:00 [migration/0] 
 +1          18       2 -51        0     0 smpboo S    ?          0:00 [idle_inject/0] 
 +1          20        20        0     0 smpboo S    ?          0:00 [cpuhp/0] 
 +1          21        20        0     0 smpboo S    ?          0:00 [cpuhp/1] 
 +1          22       2 -51        0     0 smpboo S    ?          0:00 [idle_inject/1] 
 +1          23       2 -100  -      0     0 smpboo S    ?          0:00 [migration/1] 
 +1          24        20        0     0 smpboo S    ?          0:00 [ksoftirqd/1] 
 +1          27        20        0     0 smpboo S    ?          0:00 [cpuhp/2] 
 +1          28       2 -51        0     0 smpboo S    ?          0:00 [idle_inject/2] 
 +1          29       2 -100  -      0     0 smpboo S    ?          0:00 [migration/2] 
 +1          30        20        0     0 smpboo S    ?          0:00 [ksoftirqd/2] 
 +1          32         0 -20      0     0 worker I<   ?          0:00 [kworker/2:0H-events_highpri] 
 +1          33        20        0     0 smpboo S    ?          0:00 [cpuhp/3] 
 +1          34       2 -51        0     0 smpboo S    ?          0:00 [idle_inject/3] 
 +1          35       2 -100  -      0     0 smpboo S    ?          0:00 [migration/3] 
 +1          36        20        0     0 smpboo S    ?          0:00 [ksoftirqd/3] 
 +1          38         0 -20      0     0 worker I<   ?          0:00 [kworker/3:0H-events_highpri] 
 +5          42        20        0     0 devtmp S    ?          0:00 [kdevtmpfs] 
 +1          43         0 -20      0     0 rescue I<   ?          0:00 [inet_frag_wq] 
 +1          44        20        0     0 kaudit S    ?          0:00 [kauditd] 
 +1          45        20        0     0 watchd S    ?          0:00 [khungtaskd] 
 +1          46        20        0     0 oom_re S    ?          0:00 [oom_reaper] 
 +1          47         0 -20      0     0 rescue I<   ?          0:00 [writeback] 
 +1          48        20        0     0 kcompa S    ?          0:02 [kcompactd0] 
 +1          49        25        0     0 ksm_sc SN   ?          0:00 [ksmd] 
 +1          50        39  19      0     0 khugep SN   ?          0:00 [khugepaged] 
 +1          51         0 -20      0     0 rescue I<   ?          0:00 [cryptd] 
 +1          52         0 -20      0     0 rescue I<   ?          0:00 [kintegrityd] 
 +1          53         0 -20      0     0 rescue I<   ?          0:00 [kblockd] 
 +1          54         0 -20      0     0 rescue I<   ?          0:00 [blkcg_punt_bio] 
 +1          55         0 -20      0     0 rescue I<   ?          0:00 [tpm_dev_wq] 
 +1          56         0 -20      0     0 rescue I<   ?          0:00 [md] 
 +1          57         0 -20      0     0 rescue I<   ?          0:00 [md_bitmap] 
 +1          58         0 -20      0     0 rescue I<   ?          0:00 [edac-poller] 
 +1          59       2 -51        0     0 kthrea S    ?          0:00 [watchdogd] 
 +1          61         0 -20      0     0 worker I<   ?          0:00 [kworker/0:1H-kblockd] 
 +1          62        20        0     0 kswapd S    ?          0:00 [kswapd0] 
 +1          69         0 -20      0     0 rescue I<   ?          0:00 [kthrotld] 
 +1          76         0 -20      0     0 rescue I<   ?          0:00 [acpi_thermal_pm] 
 +1          77         0 -20      0     0 rescue I<   ?          0:00 [kmpath_rdacd] 
 +1          78         0 -20      0     0 rescue I<   ?          0:00 [kaluad] 
 +--More-- 
 +[q]
 </code> </code>
  
-====1.2 - La Commande lastlog====+On note dans cette sortie certaines informations supplémentaires :
  
-Cette commande indique les dates et heures de la connexion au système la plus récente des utilisateurs :+^ VSZ | La même chose que SZ dans l'exemple ci-dessus | 
 +^ RSS | La mémoire utilisée en kilobytes par le processus | 
 +^ STAT | La même chose que S dans l'exemple ci-dessus |
  
-<code> 
-[root@centos8 ~]# lastlog 
-Username         Port     From             Latest 
-root             pts/                    Thu Jun  3 09:01:46 -0400 2021 
-bin                                        **Never logged in** 
-daemon                                     **Never logged in** 
-adm                                        **Never logged in** 
-lp                                         **Never logged in** 
-sync                                       **Never logged in** 
-shutdown                                   **Never logged in** 
-halt                                       **Never logged in** 
-mail                                       **Never logged in** 
-operator                                   **Never logged in** 
-games                                      **Never logged in** 
-ftp                                        **Never logged in** 
-nobody                                     **Never logged in** 
-dbus                                       **Never logged in** 
-systemd-coredump                           **Never logged in** 
-systemd-resolve                            **Never logged in** 
-tss                                        **Never logged in** 
-polkitd                                    **Never logged in** 
-unbound                                    **Never logged in** 
-libstoragemgmt                             **Never logged in** 
-cockpit-ws                                 **Never logged in** 
-sssd                                       **Never logged in** 
-setroubleshoot                             **Never logged in** 
-sshd                                       **Never logged in** 
-chrony                                     **Never logged in** 
-tcpdump                                    **Never logged in** 
-trainee          pts/0    10.0.2.2         Thu Jun  3 09:01:39 -0400 2021 
-cockpit-wsinstance                           **Never logged in** 
-rngd                                       **Never logged in** 
-gluster                                    **Never logged in** 
-qemu                                       **Never logged in** 
-rpc                                        **Never logged in** 
-rpcuser                                    **Never logged in** 
-saslauth                                   **Never logged in** 
-radvd                                      **Never logged in** 
-dnsmasq                                    **Never logged in** 
-fenestros2       pts/                    Tue Apr 20 15:20:26 -0400 2021 
-fenestros1                                 **Never logged in** 
-apache                                     **Never logged in** 
-</code> 
  
-Les option de cette commande sont :+Avec des options a,u et x la commande affiche le résultat suivant :
  
 <code> <code>
-[root@centos8 ~]# lastlog --help +[root@redhat9 ~]# ps aux | more 
-Usagelastlog [options+USER         PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND 
- +root            0.0  0.2 190992 17880 ?        Ss   Sep25   0:13 /usr/lib/systemd/systemd rhgb --switched-root --system --deserialize 31 
-Options+root            0.0  0.0      0     0 ?        S    Sep25   0:00 [kthreadd
-  -b, --before DAYS             print only lastlog records older than DAYS +root            0.0  0.0      0     0 ?        I<   Sep25   0:00 [rcu_gp] 
-  -C, --clear                   clear lastlog record of an user (usable only with -u) +root            0.0  0.0      0     0 ?        I<   Sep25   0:00 [rcu_par_gp] 
-  -h, --help                    display this help message and exit +root            0.0  0.0      0     0 ?        I<   Sep25   0:00 [slub_flushwq] 
-  -R, --root CHROOT_DIR         directory to chroot into +root            0.0  0.0      0     0 ?        I<   Sep25   0:00 [netns] 
-  -S--set                     set lastlog record to current time (usable only with -u) +root            0.0  0.0      0     0 ?        I<   Sep25   0:00 [kworker/0:0H-events_highpri] 
-  -t, --time DAYS               print only lastlog records more recent than DAYS +root          10  0.0  0.0      0     0 ?        I<   Sep25   0:00 [mm_percpu_wq] 
-  -u, --user LOGIN              print lastlog record of the specified LOGIN+root          12  0.0  0.0      0     0 ?        I    Sep25   0:00 [rcu_tasks_kthre] 
 +root          13  0.0  0.0      0     0 ?        I    Sep25   0:00 [rcu_tasks_rude_] 
 +root          14  0.0  0.0      0     0 ?        I    Sep25   0:00 [rcu_tasks_trace] 
 +root          15  0.0  0.0      0     0 ?        S    Sep25   0:00 [ksoftirqd/0] 
 +root          16  0.0  0.0      0     0 ?        I    Sep25   0:01 [rcu_preempt] 
 +root          17  0.0  0.0      0     0 ?        S    Sep25   0:00 [migration/0] 
 +root          18  0.0  0.0      0     0 ?        S    Sep25   0:00 [idle_inject/0] 
 +root          20  0.0  0.0      0     0 ?        S    Sep25   0:00 [cpuhp/0] 
 +root          21  0.0  0.0      0     0 ?        S    Sep25   0:00 [cpuhp/1] 
 +root          22  0.0  0.0      0     0 ?        S    Sep25   0:00 [idle_inject/1] 
 +root          23  0.0  0.0      0     0 ?        S    Sep25   0:00 [migration/1] 
 +root          24  0.0  0.0      0     0 ?        S    Sep25   0:00 [ksoftirqd/1] 
 +root          27  0.0  0.0      0     0 ?        S    Sep25   0:00 [cpuhp/2] 
 +root          28  0.0  0.0      0     0 ?        S    Sep25   0:00 [idle_inject/2] 
 +root          29  0.0  0.0      0     0 ?        S    Sep25   0:00 [migration/2] 
 +root          30  0.0  0.0      0     0 ?        S    Sep25   0:00 [ksoftirqd/2] 
 +root          32  0.0  0.0      0     0 ?        I<   Sep25   0:00 [kworker/2:0H-events_highpri] 
 +root          33  0.0  0.0      0     0 ?        S    Sep25   0:00 [cpuhp/3] 
 +root          34  0.0  0.0      0     0 ?           Sep25   0:00 [idle_inject/3] 
 +root          35  0.0  0.0      0     0 ?        S    Sep25   0:00 [migration/3] 
 +root          36  0.0  0.0      0     0 ?        S    Sep25   0:00 [ksoftirqd/3] 
 +root          38  0.0  0.0      0     0 ?        I<   Sep25   0:00 [kworker/3:0H-events_highpri] 
 +root          42  0.0  0.0      0     0 ?        S    Sep25   0:00 [kdevtmpfs] 
 +root          43  0.0  0.0      0     0 ?        I<   Sep25   0:00 [inet_frag_wq] 
 +root          44  0.0  0.0      0     0 ?        S    Sep25   0:00 [kauditd] 
 +root          45  0.0  0.0      0     0 ?        S    Sep25   0:00 [khungtaskd] 
 +root          46  0.0  0.0      0     0 ?        S    Sep25   0:00 [oom_reaper] 
 +root          47  0.0  0.0      0     0 ?        I<   Sep25   0:00 [writeback] 
 +root          48  0.0  0.0      0     0 ?        S    Sep25   0:02 [kcompactd0] 
 +root          49  0.0  0.0      0     0 ?        SN   Sep25   0:00 [ksmd] 
 +root          50  0.0  0.0      0     0 ?        SN   Sep25   0:00 [khugepaged] 
 +root          51  0.0  0.0      0     0 ?        I<   Sep25   0:00 [cryptd] 
 +root          52  0.0  0.0      0     0 ?        I<   Sep25   0:00 [kintegrityd] 
 +root          53  0.0  0.0      0     0 ?        I<   Sep25   0:00 [kblockd] 
 +root          54  0.0  0.0      0     0 ?        I<   Sep25   0:00 [blkcg_punt_bio] 
 +root          55  0.0  0.0      0     0 ?        I<   Sep25   0:00 [tpm_dev_wq] 
 +root          56  0.0  0.0      0     0 ?        I<   Sep25   0:00 [md] 
 +root          57  0.0  0.0      0     0 ?        I<   Sep25   0:00 [md_bitmap] 
 +root          58  0.0  0.0      0     0 ?        I<   Sep25   0:00 [edac-poller] 
 +root          59  0.0  0.0      0     0 ?        S    Sep25   0:00 [watchdogd] 
 +root          61  0.0  0.0      0     0 ?        I<   Sep25   0:00 [kworker/0:1H-kblockd] 
 +root          62  0.0  0.0      0     0 ?        S    Sep25   0:00 [kswapd0] 
 +root          69  0.0  0.0      0     0 ?        I<   Sep25   0:00 [kthrotld] 
 +root          76  0.0  0.0      0     0 ?        I<   Sep25   0:00 [acpi_thermal_pm] 
 +root          77  0.0  0.0      0     0 ?        I<   Sep25   0:00 [kmpath_rdacd] 
 +root          78  0.0  0.0      0     0 ?        I<   Sep25   0:00 [kaluad] 
 +--More-
 +[q]
 </code> </code>
  
-====1.3 - La Commande lastb====+On note dans cette sortie certaines informations supplémentaires :
  
-Cette commande indique les dates et heures des connexions infructueuses des utilisateurs à partir du contenu du fichier **/var/log/btmp** : +^ USER | L'utilisateur du processus | 
- +^ %CPU | Ressources du microprocesseur utilisées par le processus | 
-<code> +^ %MEM | Ressources en mémoire vive utilisées par le processus |
-[root@centos8 ~]# lastb +
-trainee  tty1                          Thu Jun  3 09:51 - 09:51  (00:00) +
-trainee  tty1                          Thu Jun  3 09:51 - 09:51  (00:00) +
-trqinee  tty1                          Thu Jun  3 09:51 - 09:51  (00:00) +
- +
-btmp begins Thu Jun  3 09:51:07 2021 +
-</code>+
  
 Les options de cette commande sont : Les options de cette commande sont :
  
 <code> <code>
-[root@centos8 ~]# lastb --help+[root@redhat9 ~]# ps --help all
  
 Usage: Usage:
- lastb [options] [<username>...] [<tty>...]+ ps [options]
  
-Show listing of last logged in users.+Basic options: 
 + -A, -e               all processes 
 + -                  all with tty, except session leaders 
 +  a                   all with tty, including other users 
 + -d                   all except session leaders 
 + -N, --deselect       negate selection 
 +  r                   only running processes 
 +  T                   all processes on this terminal 
 +  x                   processes without controlling ttys
  
-Options+Selection by list
- -<number           how many lines to show + -<command        command name 
- -a, --hostlast       display hostnames in the last column + -G, --Group <GID>    real group id or name 
- -d, --dns            translate the IP number back into a hostname + -g, --group <group>  session or effective group name 
- -f, --file <file   use a specific file instead of /var/log/btmp + -p, p, --pid <PID  process id 
- -F, --fulltimes      print full login and logout times and dates +        --ppid <PID>  parent process id 
- -i, --ip             display IP numbers in numbers-and-dots notation + -q, q, --quick-pid <PID
- -n, --limit <numberhow many lines to show +                      process id (quick mode) 
- -R, --nohostname     don't display the hostname field + -s, --sid <session session id 
- -s, --since <time  display the lines since the specified time + -t, t, --tty <tty>   terminal 
- -t, --until <time>   display the lines until the specified time + -u, U, --user <UID effective user id or name 
- -p, --present <timedisplay who were present at the specified time + -U, --User <UID    real user id or name
- -w, --fullnames      display full user and domain names +
- -x, --system         display system shutdown entries and run level changes +
-     --time-format <format show timestamps in the specified <format>: +
-                               notime|short|full|iso+
  
- -h--help           display this help +  The selection options take as their argument either: 
- -V, --version        display version+    a comma-separated list e.g. '-u root,nobody' or 
 +    a blank-separated list e.g. '-p 123 4567'
  
-For more details see last(1). +Output formats: 
-</code>+ -F                   extra full 
 + -f                   full-format, including command lines 
 +  f, --forest         ascii art process tree 
 + -H                   show process hierarchy 
 + -j                   jobs format 
 +  j                   BSD job control format 
 + -l                   long format 
 +  l                   BSD long format 
 + -M, Z                add security data (for SELinux) 
 + -O <format>          preloaded with default columns 
 +  O <format>          as -O, with BSD personality 
 + -o, o, --format <format> 
 +                      user-defined format 
 +  s                   signal format 
 +  u                   user-oriented format 
 +  v                   virtual memory format 
 +  X                   register format 
 + -y                   do not show flags, show rss vsaddr (used with -l) 
 +     --context        display security context (for SELinux) 
 +     --headers        repeat header lines, one per page 
 +     --no-headers     do not print header at all 
 +     --cols, --columns, --width <num> 
 +                      set screen width 
 +     --rows, --lines <num> 
 +                      set screen height
  
-====1.4 Le Fichier /var/log/secure====+Show threads: 
 +  H                   as if they were processes 
 + -L                   possibly with LWP and NLWP columns 
 + -m, m                after processes 
 + -T                   possibly with SPID column
  
-Sous RHEL/CentOS ce fichier contient la journalisation des opérations de gestion des authentifications :+Miscellaneous options: 
 + -c                   show scheduling class with -l option 
 +  c                   show true command name 
 +  e                   show the environment after command 
 +  k,    --sort        specify sort order as: [+|-]key[,[+|-]key[,...]] 
 +  L                   show format specifiers 
 +  n                   display numeric uid and wchan 
 +  S,    --cumulative  include some dead child process data 
 + -y                   do not show flags, show rss (only with -l) 
 + -V, V, --version     display version information and exit 
 + -w, w                unlimited output width
  
-<code+        --help <simple|list|output|threads|misc|all
-[root@centos8 ~]# tail -n 15 /var/log/secure +                      display help and exit 
-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 +For more details see ps(1).
-Jun  3 09:01:39 centos8 systemd[1590]: pam_unix(systemd-user:session): session opened for user trainee by (uid=0) +
-Jun  3 09:01:39 centos8 sshd[1585]: pam_unix(sshd:session): session opened for user trainee by (uid=0) +
-Jun  3 09:01:46 centos8 su[1627]: pam_systemd(su-l:session): Cannot create session: Already running in a session or user slice +
-Jun  3 09:01:46 centos8 su[1627]: pam_unix(su-l:session): session opened for user root by trainee(uid=1000) +
-Jun  3 09:51:05 centos8 login[1158]: pam_unix(login:auth): check pass; user unknown +
-Jun  3 09:51:05 centos8 login[1158]: pam_unix(login:auth): authentication failure; logname=LOGIN uid=0 euid=0 tty=tty1 ruser= rhost= +
-Jun  3 09:51:07 centos8 login[1158]: FAILED LOGIN FROM tty1 FOR trqinee, Authentication failure +
-Jun  3 09:51:18 centos8 unix_chkpwd[2400]: password check failed for user (trainee) +
-Jun  3 09:51:18 centos8 login[1158]: pam_unix(login:auth): authentication failure; logname=LOGIN uid=0 euid=0 tty=tty1 ruser= rhost=  user=trainee +
-Jun  3 09:51:20 centos8 login[1158]: FAILED LOGIN 2 FROM tty1 FOR trainee, Authentication failure +
-Jun  3 09:51:45 centos8 login[1158]: pam_unix(login:auth): check pass; user unknown +
-Jun  3 09:51:45 centos8 login[1158]: pam_unix(login:auth): authentication failure; logname=LOGIN uid=0 euid=0 tty=tty1 ruser= rhost= +
-Jun  3 09:51:47 centos8 login[1158]: FAILED LOGIN SESSION FROM tty1 FOR trainee  , Authentication failure+
 </code> </code>
  
-====1.Gestion des Evénements audit==== +====1.La Commande pgrep====
- +
-===Le fichier /var/log/audit/audit.log=== +
- +
-Ce fichier contient les messages du système d'audit, appelés des **événements**. Le système audit est installé par défaut dans RHEL/CentOS par le paquet **audit**. Le système audit collectionne des informations telles :+
  
-  des appels système, +La commande **pgrep** permet de rechercher un processus en fonction de son nom et d’autres propriétés puis d'afficher son PID sur la sortie standard.
-  des accès aux fichiers, +
-  des informations en provenance de %%SELinux%%.+
  
-Consultez maintenant le fichier **/var/log/audit.log** :+Par exemple, la commande suivante affiche le PID du processus sshd appartenant à root :
  
 <code> <code>
-[root@centos8 ~]# tail -n 15 /var/log/audit/audit.log +[root@redhat9 ~]# pgrep -root sshd 
-type=PROCTITLE msg=audit(1622728321.894:455): proctitle=2F7573722F7362696E2F63726F6E64002D6E +5734 
-type=USER_START msg=audit(1622728321.901:456): pid=2420 uid=0 auid=1000 ses=53 subj=system_u:system_r:crond_t:s0-s0:c0.c1023 msg='op=PAM:session_open grantors=pam_loginuid,pam_keyinit,pam_limits,pam_systemd acct="trainee" exe="/usr/sbin/crond" hostname=? addr=? terminal=cron res=success'UID="root" AUID="trainee" +9357
-type=CRED_REFR msg=audit(1622728321.902:457): pid=2420 uid=0 auid=1000 ses=53 subj=system_u:system_r:crond_t:s0-s0:c0.c1023 msg='op=PAM:setcred grantors=pam_env,pam_localuser,pam_unix acct="trainee" exe="/usr/sbin/crond" hostname=? addr=? terminal=cron res=success'UID="root" AUID="trainee" +
-type=CRED_DISP msg=audit(1622728321.908:458): pid=2420 uid=0 auid=1000 ses=53 subj=system_u:system_r:crond_t:s0-s0:c0.c1023 msg='op=PAM:setcred grantors=pam_env,pam_localuser,pam_unix acct="trainee" exe="/usr/sbin/crond" hostname=? addr=? terminal=cron res=success'UID="root" AUID="trainee" +
-type=USER_END msg=audit(1622728321.910:459): pid=2420 uid=0 auid=1000 ses=53 subj=system_u:system_r:crond_t:s0-s0:c0.c1023 msg='op=PAM:session_close grantors=pam_loginuid,pam_keyinit,pam_limits,pam_systemd acct="trainee" exe="/usr/sbin/crond" hostname=? addr=? terminal=cron res=success'UID="root" AUID="trainee" +
-type=SERVICE_STOP msg=audit(1622728330.965:460): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=fprintd comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'UID="root" AUID="unset" +
-type=USER_ACCT msg=audit(1622728381.954:461): pid=2439 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:crond_t:s0-s0:c0.c1023 msg='op=PAM:accounting grantors=pam_access,pam_unix,pam_localuser acct="trainee" exe="/usr/sbin/crond" hostname=? addr=? terminal=cron res=success'UID="root" AUID="unset" +
-type=CRED_ACQ msg=audit(1622728381.954:462): pid=2439 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:crond_t:s0-s0:c0.c1023 msg='op=PAM:setcred grantors=pam_env,pam_localuser,pam_unix acct="trainee" exe="/usr/sbin/crond" hostname=? addr=? terminal=cron res=success'UID="root" AUID="unset" +
-type=LOGIN msg=audit(1622728381.954:463): pid=2439 uid=0 subj=system_u:system_r:crond_t:s0-s0:c0.c1023 old-auid=4294967295 auid=1000 tty=(none) old-ses=4294967295 ses=54 res=1UID="root" OLD-AUID="unset" AUID="trainee" +
-type=SYSCALL msg=audit(1622728381.954:463): arch=c000003e syscall=1 success=yes exit=4 a0=7 a1=7ffdcd7a6d50 a2=4 a3=0 items=0 ppid=1126 pid=2439 auid=1000 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=54 comm="crond" exe="/usr/sbin/crond" subj=system_u:system_r:crond_t:s0-s0:c0.c1023 key=(null)ARCH=x86_64 SYSCALL=write AUID="trainee" UID="root" GID="root" EUID="root" SUID="root" FSUID="root" EGID="root" SGID="root" FSGID="root" +
-type=PROCTITLE msg=audit(1622728381.954:463): proctitle=2F7573722F7362696E2F63726F6E64002D6E +
-type=USER_START msg=audit(1622728381.960:464): pid=2439 uid=0 auid=1000 ses=54 subj=system_u:system_r:crond_t:s0-s0:c0.c1023 msg='op=PAM:session_open grantors=pam_loginuid,pam_keyinit,pam_limits,pam_systemd acct="trainee" exe="/usr/sbin/crond" hostname=? addr=? terminal=cron res=success'UID="root" AUID="trainee" +
-type=CRED_REFR msg=audit(1622728381.962:465): pid=2439 uid=0 auid=1000 ses=54 subj=system_u:system_r:crond_t:s0-s0:c0.c1023 msg='op=PAM:setcred grantors=pam_env,pam_localuser,pam_unix acct="trainee" exe="/usr/sbin/crond" hostname=? addr=? terminal=cron res=success'UID="root" AUID="trainee" +
-type=CRED_DISP msg=audit(1622728381.966:466): pid=2439 uid=0 auid=1000 ses=54 subj=system_u:system_r:crond_t:s0-s0:c0.c1023 msg='op=PAM:setcred grantors=pam_env,pam_localuser,pam_unix acct="trainee" exe="/usr/sbin/crond" hostname=? addr=? terminal=cron res=success'UID="root" AUID="trainee" +
-type=USER_END msg=audit(1622728381.968:467): pid=2439 uid=0 auid=1000 ses=54 subj=system_u:system_r:crond_t:s0-s0:c0.c1023 msg='op=PAM:session_close grantors=pam_loginuid,pam_keyinit,pam_limits,pam_systemd acct="trainee" exe="/usr/sbin/crond" hostname=? addr=? terminal=cron res=success'UID="root" AUID="trainee"+
 </code> </code>
  
-La gestion des événements audit se repose sur trois exécutables : +Tandis que la commande suivante affiche tous les PID des processus appartenant à root ou à trainee :
- +
-===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 **/etc/audit/auditd.conf** :+
  
 <code> <code>
-[root@centos8 ~]# cat /etc/audit/auditd.conf +[root@redhat9 ~]# pgrep -u root,trainee | more 
-# +1 
-# This file controls the configuration of the audit daemon +2 
-# +3 
- +4 
-local_events = yes +5 
-write_logs = yes +6 
-log_file = /var/log/audit/audit.log +8 
-log_group = root +10 
-log_format = ENRICHED +12 
-flush = INCREMENTAL_ASYNC +13 
-freq = 50 +14 
-max_log_file = 8 +15 
-num_logs = 5 +16 
-priority_boost = 4 +17 
-name_format = NONE +18 
-##name = mydomain +20 
-max_log_file_action = ROTATE +21 
-space_left = 75 +22 
-space_left_action = SYSLOG +23 
-verify_email = yes +24 
-action_mail_acct = root +27 
-admin_space_left = 50 +28 
-admin_space_left_action = SUSPEND +29 
-disk_full_action = SUSPEND +30 
-disk_error_action = SUSPEND +32 
-use_libwrap = yes +33 
-##tcp_listen_port = 60 +34 
-tcp_listen_queue = 5 +35 
-tcp_max_per_addr = 1 +36 
-##tcp_client_ports = 1024-65535 +38 
-tcp_client_max_idle = 0 +42 
-transport = TCP +43 
-krb5_principal = auditd +44 
-##krb5_key_file = /etc/audit/audit.key +45 
-distribute_network = no +46 
-q_depth = 400 +47 
-overflow_action = SYSLOG +48 
-max_restarts = 10 +49 
-plugin_dir = /etc/audit/plugins.d+50 
 +51 
 +52 
 +53 
 +54 
 +55 
 +56 
 +57 
 +58 
 +59 
 +61 
 +62 
 +69 
 +76 
 +77 
 +78 
 +79 
 +--More-- 
 +[q]
 </code> </code>
  
-Les option de cette commande sont :+Les options de cette commande sont :
  
 <code> <code>
-[root@centos8 ~]# auditd --help +[root@redhat9 ~]# pgrep --help
-auditd: unrecognized option '--help' +
-Usage: auditd [-f] [-l] [-n] [-s disable|enable|nochange] [-c <config_file>+
-</code>+
  
-===auditctl===+Usage: 
 + pgrep [options] <pattern>
  
-Cet exécutable est utilisé pour configurer les règles du système auditAu démarrageauditctl lit et applique les règles contunues dans le fichier **/etc/audit/audit.rules** :+Options: 
 + -d, --delimiter <string>  specify output delimiter 
 + -l, --list-name           list PID and process name 
 + -a, --list-full           list PID and full command line 
 + -v, --inverse             negates the matching 
 + -w, --lightweight         list all TID 
 + -c, --count               count of matching processes 
 + -f, --full                use full process name to match 
 + -g, --pgroup <PGID,...>   match listed process group IDs 
 + -G, --group <GID,...>     match real group IDs 
 + -i, --ignore-case         match case insensitively 
 + -n, --newest              select most recently started 
 + -o, --oldest              select least recently started 
 + -O, --older <seconds>     select where older than seconds 
 + -P, --parent <PPID,...>   match only child processes of the given parent 
 + -s, --session <SID,...>   match session IDs 
 + -t, --terminal <tty,...>  match by controlling terminal 
 + -u, --euid <ID,...>       match by effective IDs 
 + -U, --uid <ID,...>        match by real IDs 
 + -x, --exact               match exactly with the command name 
 + -F, --pidfile <file>      read PIDs from file 
 + -L, --logpidfile          fail if PID file is not locked 
 + -r, --runstates <state>   match runstates [D,S,Z,...] 
 + --ns <PID>                match the processes that belong to the same 
 +                           namespace as <pid> 
 + --nslist <ns,...>         list which namespaces will be considered for 
 +                           the --ns option. 
 +                           Available namespacesipc, mnt, net, pid, user, uts
  
-<code> + -h, --help     display this help and exit 
-[root@centos8 ~]# cat /etc/audit/audit.rules + -V, --version  output version information and exit
-## This file is automatically generated from /etc/audit/rules.d +
--+
--b 8192 +
--f 1 +
---backlog_wait_time 60000+
  
 +For more details see pgrep(1).
 </code> </code>
  
-Les options de cette commande sont :+====1.3 - La Commande pstree==== 
 + 
 +Cette commande affiche les processus en forme d'arborescence, démontrant ainsi les processus parents en enfants :
  
 <code> <code>
-[root@centos8 ~]# auditctl --help +[root@redhat9 ~]# pstree 
-usage: auditctl [options+systemd─┬─ModemManager───3*[{ModemManager}] 
-    -a <l,a>            Append rule to end of <l>ist with <a>ction +        ├─NetworkManager───2*[{NetworkManager}] 
-    -A <l,a>            Add rule at beginning of <l>ist with <a>ction +        ├─accounts-daemon───3*[{accounts-daemon}] 
-    -b <backlog>        Set max number of outstanding audit buffers +        ├─at-spi-bus-laun─┬─dbus-daemon 
-                        allowed Default=64 +        │                 └─3*[{at-spi-bus-laun}
-    -c                  Continue through errors in rules +        ├─at-spi2-registr───2*[{at-spi2-registr}] 
-    -C f=f              Compare collected fields if available: +        ├─atd 
-                        Field name, operator(=,!=), field name +        ├─auditd─┬─sedispatch 
-    -d <l,a>            Delete rule from <l>ist with <a>ction +        │        └─2*[{auditd}] 
-                        l=task,exit,user,exclude +        ├─avahi-daemon───avahi-daemon 
-                        a=never,always +        ├─colord───3*[{colord}] 
-    -D                  Delete all rules and watches +        ├─crond 
-    -[0..2          Set enabled flag +        ├─cupsd 
-    -[0..2          Set failure flag +        ├─dbus-broker-lau───dbus-broker 
-                        0=silent 1=printk 2=panic +        ├─firewalld───{firewalld} 
-    -F f=v              Build rule: field name, operator(=,!=,<,>,<=, +        ├─gdm─┬─gdm-session-wor─┬─gdm-wayland-ses─┬─dbus-run-sessio─┬─dbus-daemon 
-                        >=,&,&=) value +        │     │                 │                 │                 └─gnome-session-b─┬─gnome-shell─┬─Xwayland 
-    -h                  Help +        │     │                 │                 │                                   │             ├─ibus-daemon─┬─ibus-dconf───3*[{ibus-dconf}] 
-    -i                  Ignore errors when reading rules from file +        │     │                 │                 │                                   │             │             ├─ibus-engine-sim───2*[{ibus-engine-sim}] 
-    -k <key>            Set filter key on audit rule +        │     │                 │                 │                                   │             │             └─2*[{ibus-daemon}] 
-    -l                  List rules +        │     │                 │                 │                                   │             └─17*[{gnome-shell}] 
-    -m text             Send a user-space message +        │     │                 │                 │                                   ├─gsd-a11y-settin───3*[{gsd-a11y-settin}
-    -[r|w|x|a]        Set permissions filter on watch +        │     │                 │                 │                                   ├─gsd-color───3*[{gsd-color}
-                        r=read, w=write, x=execute, a=attribute +        │     │                 │                 │                                   ├─gsd-datetime───3*[{gsd-datetime}] 
-    -q <mount,subtree>  make subtree part of mount point's dir watches +        │     │                 │                 │                                   ├─gsd-housekeepin───3*[{gsd-housekeepin}] 
-    -r <rate>           Set limit in messages/sec (0=none) +        │     │                 │                 │                                   ├─gsd-keyboard───3*[{gsd-keyboard}] 
-    -R <file>           read rules from file +        │     │                 │                 │                                   ├─gsd-media-keys───3*[{gsd-media-keys}] 
-    -s                  Report status +        │     │                 │                 │                                   ├─gsd-power───3*[{gsd-power}] 
-    -S syscall          Build rule: syscall name or number +        │     │                 │                 │                                   ├─gsd-print-notif───2*[{gsd-print-notif}] 
-    -t                  Trim directory watches +        │     │                 │                 │                                   ├─gsd-rfkill───2*[{gsd-rfkill}] 
-    -v                  Version +        │     │                 │                 │                                   ├─gsd-screensaver───2*[{gsd-screensaver}] 
-    -w <path>           Insert watch at <path> +        │     │                 │                 │                                   ├─gsd-sharing───3*[{gsd-sharing}] 
-    -W <path>           Remove watch at <path> +        │     │                 │                 │                                   ├─gsd-smartcard───5*[{gsd-smartcard}] 
-    --loginuid-immutable  Make loginuids unchangeable once set +        │     │                 │                 │                                   ├─gsd-sound───3*[{gsd-sound}] 
-    --backlog_wait_time  Set the kernel backlog_wait_time +        │     │                 │                 │                                   ├─gsd-wacom───3*[{gsd-wacom}] 
-    --reset-lost         Reset the lost record counter+        │     │                 │                 │                                   └─3*[{gnome-session-b}] 
 +        │     │                 │                 └─2*[{gdm-wayland-ses}] 
 +        │     │                 └─2*[{gdm-session-wor}] 
 +        │     └─2*[{gdm}] 
 +        ├─2*[gjs───6*[{gjs}]] 
 +        ├─gsd-printer───2*[{gsd-printer}] 
 +        ├─3*[httpd─┬─httpd] 
 +        │          ├─httpd───68*[{httpd}]] 
 +        │          └─2*[httpd───52*[{httpd}]]] 
 +        ├─ibus-portal───2*[{ibus-portal}] 
 +        ├─ibus-x11───2*[{ibus-x11}] 
 +        ├─irqbalance───{irqbalance} 
 +        ├─lsmd 
 +        ├─mcelog 
 +        ├─polkitd───7*[{polkitd}] 
 +        ├─power-profiles-───2*[{power-profiles-}] 
 +        ├─rhsmcertd───{rhsmcertd} 
 +        ├─rsyslogd───2*[{rsyslogd}] 
 +        ├─rtkit-daemon───2*[{rtkit-daemon}] 
 +        ├─sshd───sshd───sshd───bash───su───bash───pstree 
 +        ├─switcheroo-cont───2*[{switcheroo-cont}] 
 +        ├─systemd─┬─(sd-pam) 
 +        │         ├─dbus-broker-lau───dbus-broker 
 +        │         ├─pipewire───2*[{pipewire}] 
 +        │         ├─pipewire-pulse───2*[{pipewire-pulse}] 
 +        │         └─wireplumber───4*[{wireplumber}] 
 +        ├─systemd───(sd-pam) 
 +        ├─systemd-journal 
 +        ├─systemd-logind 
 +        ├─systemd-udevd 
 +        ├─udisksd───4*[{udisksd}] 
 +        ├─upowerd───2*[{upowerd}] 
 +        ├─wpa_supplicant 
 +        └─xdg-permission-───2*[{xdg-permission-}]
 </code> </code>
  
-===La consultation des événements audit=== +Les options de cette commande sont :
- +
-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 :+
  
 <code> <code>
-[root@centos8 ~]# aureport+[root@redhat9 ~]# pstree --help 
 +pstree: unrecognized option '--help' 
 +Usage: pstree [-acglpsStTuZ] [ -h | -H PID ] [ -n | -N type ] 
 +              [ -A | -G | -U ] [ PID | USER ] 
 +   or: pstree -V
  
-Summary Report +Display a tree of processes.
-====================== +
-Range of time in logs: 05/08/2020 08:13:52.320 - 06/03/2021 10:20:02.028 +
-Selected time for report: 05/08/2020 08:13:52 - 06/03/2021 10:20:02.028 +
-Number of changes in configuration: 46 +
-Number of changes to accounts, groups, or roles: 56 +
-Number of logins: 21 +
-Number of failed logins: 5 +
-Number of authentications: 50 +
-Number of failed authentications:+
-Number of users: 3 +
-Number of terminals: 10 +
-Number of host names: 4 +
-Number of executables: 22 +
-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 +
-</code>+
  
-Les options de cette commande sont :+  -a, --arguments     show command line arguments 
 +  -A, --ascii         use ASCII line drawing characters 
 +  -c, --compact-not   don't compact identical subtrees 
 +  -C, --color=TYPE    color process by attribute 
 +                      (age) 
 +  -g, --show-pgids    show process group ids; implies -c 
 +  -G, --vt100         use VT100 line drawing characters 
 +  -h, --highlight-all highlight current process and its ancestors 
 +  -H PID, --highlight-pid=PID 
 +                      highlight this process and its ancestors 
 +  -l, --long          don't truncate long lines 
 +  -n, --numeric-sort  sort output by PID 
 +  -N TYPE, --ns-sort=TYPE 
 +                      sort output by this namespace type 
 +                              (cgroup, ipc, mnt, net, pid, time, user, uts) 
 +  -p, --show-pids     show PIDs; implies -c 
 +  -s, --show-parents  show parents of the selected process 
 +  -S, --ns-changes    show namespace transitions 
 +  -t, --thread-names  show full thread names 
 +  -T, --hide-threads  hide threads, show only processes 
 +  -u, --uid-changes   show uid transitions 
 +  -U, --unicode       use UTF-8 (Unicode) line drawing characters 
 +  -V, --version       display version information 
 +  -Z, --security-context 
 +                      show security attributes
  
-<code> +  PID    start at this PID; default is (init
-[root@centos8 ~]# aureport --help +  USER   show only trees rooted at processes of this user
-usage: aureport [options] +
- -a,--avc Avc report +
- -au,--auth Authentication report +
- --comm Commands run report +
- -c,--config Config change report +
- -cr,--crypto Crypto report +
- -e,--event Event report +
- -f,--file File name report +
- --failed only failed events in report +
- -h,--host Remote Host name report +
- --help help +
- -i,--interpret Interpretive mode +
- -if,--input <Input File name> use this file as input +
- --input-logs Use the logs even if stdin is a pipe +
- --integrity Integrity event report +
- -l,--login Login report +
- -k,--key Key report +
- -m,--mods Modification to accounts report +
- -ma,--mac Mandatory Access Control (MACreport +
- -n,--anomaly aNomaly report +
- -nc,--no-config Don't include config events +
- --node <node name> Only events from a specific node +
- -p,--pid Pid report +
- -r,--response Response to anomaly report +
- -s,--syscall Syscall report +
- --success only success events in report +
- --summary sorted totals for main object in report +
- -t,--log Log time range report +
- -te,--end [end date] [end time] ending date & time for reports +
- -tm,--terminal TerMinal name report +
- -ts,--start [start date] [start time] starting data & time for reports +
- --tty Report about tty keystrokes +
- -u,--user User name report +
- -v,--version Version +
- --virt Virtualization report +
- -x,--executable eXecutable name report +
- If no report is given, the summary report will be displayed+
 </code> </code>
  
-==La Commande ausearch==+====1.4 - La Commande top====
  
-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 :+Cette commande indique les processus en mémoire :
  
 <code> <code>
-[root@centos8 ~]# ausearch -ui 1000 | more +[root@redhat9 ~]# top
----- +
-time->Tue Sep  1 11:05:28 2020 +
-type=USER_AUTH msg=audit(1598972728.209:77): pid=1633 uid=1000 auid=1000 ses=1 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 msg='op=PAM:authentication grantors=pam_unix acct="root" exe="/usr/bin/su" hostname=localhost.locald +
-omain addr=? terminal=pts/0 res=success' +
----- +
-time->Tue Sep  1 11:05:28 2020 +
-type=USER_ACCT msg=audit(1598972728.214:78): pid=1633 uid=1000 auid=1000 ses=1 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 msg='op=PAM:accounting grantors=pam_unix,pam_localuser acct="root" exe="/usr/bin/su" hostname=localh +
-ost.localdomain addr=? terminal=pts/0 res=success' +
----- +
-time->Tue Sep  1 11:05:28 2020 +
-type=CRED_ACQ msg=audit(1598972728.218:79): pid=1633 uid=1000 auid=1000 ses=1 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 msg='op=PAM:setcred grantors=pam_unix acct="root" exe="/usr/bin/su" hostname=localhost.localdomain ad +
-dr=? terminal=pts/0 res=success' +
----- +
-time->Tue Sep  1 11:05:28 2020 +
-type=USER_START msg=audit(1598972728.223:80): pid=1633 uid=1000 auid=1000 ses=1 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 msg='op=PAM:session_open grantors=pam_keyinit,pam_keyinit,pam_limits,pam_systemd,pam_unix,pam_umask +
-,pam_xauth acct="root" exe="/usr/bin/su" hostname=localhost.localdomain addr=? terminal=pts/0 res=success' +
----- +
-time->Tue Sep  1 11:10:13 2020 +
-type=USER_END msg=audit(1598973013.687:87): pid=1633 uid=1000 auid=1000 ses=1 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 msg='op=PAM:session_close grantors=pam_keyinit,pam_keyinit,pam_limits,pam_systemd,pam_unix,pam_umask, +
-pam_xauth acct="root" exe="/usr/bin/su" hostname=localhost.localdomain addr=? terminal=pts/0 res=success' +
----- +
-time->Tue Sep  1 11:10:13 2020 +
-type=CRED_DISP msg=audit(1598973013.687:88): pid=1633 uid=1000 auid=1000 ses=1 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 msg='op=PAM:setcred grantors=pam_unix acct="root" exe="/usr/bin/su" hostname=localhost.localdomain a +
-ddr=? terminal=pts/0 res=success' +
----- +
-time->Mon Apr 19 11:48:01 2021 +
-type=USER_AUTH msg=audit(1618847281.847:77): pid=1768 uid=1000 auid=1000 ses=1 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 msg='op=PAM:authentication grantors=pam_unix acct="root" exe="/usr/bin/su" hostname=centos8.ittraini +
-ng.loc addr=? terminal=pts/0 res=success' +
----- +
-time->Mon Apr 19 11:48:01 2021 +
-type=USER_ACCT msg=audit(1618847281.847:78): pid=1768 uid=1000 auid=1000 ses=1 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 msg='op=PAM:accounting grantors=pam_unix,pam_localuser acct="root" exe="/usr/bin/su" hostname=centos +
-8.ittraining.loc addr=? terminal=pts/0 res=success' +
----- +
-time->Mon Apr 19 11:48:01 2021 +
-type=CRED_ACQ msg=audit(1618847281.847:79): pid=1768 uid=1000 auid=1000 ses=1 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 msg='op=PAM:setcred grantors=pam_unix acct="root" exe="/usr/bin/su" hostname=centos8.ittraining.loc a +
-ddr=? terminal=pts/0 res=success' +
----- +
-time->Mon Apr 19 11:48:01 2021 +
-type=USER_START msg=audit(1618847281.883:80): pid=1768 uid=1000 auid=1000 ses=1 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 msg='op=PAM:session_open grantors=pam_keyinit,pam_keyinit,pam_limits,pam_systemd,pam_unix,pam_umask +
-,pam_xauth acct="root" exe="/usr/bin/su" hostname=centos8.ittraining.loc addr=? terminal=pts/0 res=success' +
----- +
-time->Mon Apr 19 12:04:39 2021 +
-type=USER_END msg=audit(1618848279.544:541): pid=1768 uid=1000 auid=1000 ses=1 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 msg='op=PAM:session_close grantors=pam_keyinit,pam_keyinit,pam_limits,pam_systemd,pam_unix,pam_umask +
-,pam_xauth acct="root" exe="/usr/bin/su" hostname=centos8.ittraining.loc addr=? terminal=pts/0 res=success' +
----- +
-time->Mon Apr 19 12:04:39 2021 +
-type=CRED_DISP msg=audit(1618848279.544:542): pid=1768 uid=1000 auid=1000 ses=1 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 msg='op=PAM:setcred grantors=pam_unix acct="root" exe="/usr/bin/su" hostname=centos8.ittraining.loc +
- addr=? terminal=pts/0 res=success' +
----- +
-time->Mon Apr 19 12:05:57 2021 +
-type=USER_AUTH msg=audit(1618848357.204:69): pid=4892 uid=1000 auid=1000 ses=1 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 msg='op=PAM:authentication grantors=? acct="root" exe="/usr/bin/su" hostname=centos8.ittraining.loc  +
-addr=? terminal=pts/0 res=failed' +
----- +
-time->Mon Apr 19 12:06:03 2021 +
-type=USER_AUTH msg=audit(1618848363.134:70): pid=4901 uid=1000 auid=1000 ses=1 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 msg='op=PAM:authentication grantors=pam_unix acct="root" exe="/usr/bin/su" hostname=centos8.ittraini +
-ng.loc addr=? terminal=pts/0 res=success' +
----- +
---More-- +
-</code> +
  
-Les options de cette commande sont :+top - 14:41:00 up 2 days,  1:56,  1 user,  load average: 0.01, 0.01, 0.00 
 +Tasks: 199 total,   1 running, 198 sleeping,   0 stopped,   0 zombie 
 +%Cpu(s):  0.1 us,  0.1 sy,  0.0 ni, 99.8 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st 
 +MiB Mem :   7685.1 total,   4518.6 free,   1105.4 used,   2375.3 buff/cache 
 +MiB Swap:   5120.0 total,   5120.0 free,      0.0 used.   6579.8 avail Mem 
  
-<code> +    PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND                                                                                                                                     
-[root@centos8 ~]# ausearch --help +  10744 root      20    226032   4096   3328 R   0.3   0.1   0:00.04 top                                                                                                                                         
-usageausearch [options] +      1 root      20    190992  17880  10644 S   0.0   0.2   0:13.87 systemd                                                                                                                                     
- -a,--event <Audit event id> search based on audit event id +      2 root      20              0      0 S   0.0   0.0   0:00.05 kthreadd                                                                                                                                    
- --arch <CPU> search based on the CPU architecture +      3 root       -20            0      0 I   0.0   0.0   0:00.00 rcu_gp                                                                                                                                      
- -c,--comm  <Comm name> search based on command line name +      4 root       -20            0      0 I   0.0   0.0   0:00.00 rcu_par_gp                                                                                                                                  
- --checkpoint <checkpoint file> search from last complete event +      5 root       -20            0      0 I   0.0   0.0   0:00.00 slub_flushwq                                                                                                                                
- --debug Write malformed events that are skipped to stderr +      6 root       -20            0      0 I   0.0   0.0   0:00.00 netns                                                                                                                                       
- -e,--exit  <Exit code or errno> search based on syscall exit code +      8 root       -20            0      0 I   0.0   0.0   0:00.00 kworker/0:0H-events_highpri                                                                                                                 
- -f,--file  <File name> search based on file name +     10 root       -20            0      0 I   0.0   0.0   0:00.00 mm_percpu_wq                                                                                                                                
- --format [raw|default|interpret|csv|text] results format options +     12 root      20              0      0 I   0.0   0.0   0:00.00 rcu_tasks_kthre                                                                                                                             
- -ga,--gid-all <all Group id> search based on All group ids +     13 root      20              0      0 I   0.0   0.0   0:00.00 rcu_tasks_rude_                                                                                                                             
- -ge,--gid-effective <effective Group id>  search based on Effective +     14 root      20              0      0 I   0.0   0.0   0:00.00 rcu_tasks_trace                                                                                                                             
- group id +     15 root      20              0      0 S   0.0   0.0   0:00.05 ksoftirqd/                                                                                                                                
- -gi,--gid <Group Id> search based on group id +     16 root      20              0      0 I   0.0   0.0   0:01.27 rcu_preempt                                                                                                                                 
- -h,--help help +     17 root      rt              0      0 S   0.0   0.0   0:00.31 migration/                                                                                                                                
- -hn,--host <Host Name> search based on remote host name +     18 root     -51              0      0 S   0.0   0.0   0:00.00 idle_inject/                                                                                                                              
- -i,--interpret Interpret results to be human readable +     20 root      20              0      0 S   0.0   0.0   0:00.00 cpuhp/                                                                                                                                    
- -if,--input <Input File name> use this file instead of current logs +     21 root      20              0      0 S   0.0   0.0   0:00.00 cpuhp/                                                                                                                                    
- --input-logs Use the logs even if stdin is a pipe +     22 root     -51              0      0 S   0.0   0.0   0:00.00 idle_inject/                                                                                                                              
- --just-one Emit just one event +     23 root      rt              0      0 S   0.0   0.0   0:00.44 migration/                                                                                                                                
- -k,--key  <key string> search based on key field +     24 root      20              0      0 S   0.0   0.0   0:00.02 ksoftirqd/                                                                                                                                
- -l, --line-buffered Flush output on every line +     27 root      20              0      0 S   0.0   0.0   0:00.00 cpuhp/                                                                                                                                    
- -m,--message  <Message type> search based on message type +     28 root     -51              0      0 S   0.0   0.0   0:00.00 idle_inject/                                                                                                                              
- -n,--node  <Node name> search based on machine's name +     29 root      rt              0      0 S   0.0   0.0   0:00.46 migration/                                                                                                                                
- -o,--object  <SE Linux Object context> search based on context of object +     30 root      20              0      0 S   0.0   0.0   0:00.01 ksoftirqd/                                                                                                                                
- -p,--pid  <Process id> search based on process id +     32 root       -20            0      0 I   0.0   0.0   0:00.00 kworker/2:0H-events_highpri                                                                                                                 
- -pp,--ppid <Parent Process id> search based on parent process id +     33 root      20              0      0 S   0.0   0.0   0:00.00 cpuhp/                                                                                                                                    
- -r,--raw output is completely unformatted +     34 root     -51              0      0 S   0.0   0.0   0:00.00 idle_inject/                                                                                                                              
- -sc,--syscall <SysCall name> search based on syscall name or number +     35 root      rt              0      0 S   0.0   0.0   0:00.47 migration/                                                                                                                                
- -se,--context <SE Linux context> search based on either subject or +     36 root      20              0      0 S   0.0   0.0   0:00.02 ksoftirqd/                                                                                                                                
- object +     38 root       -20            0      0 I   0.0   0.0   0:00.00 kworker/3:0H-events_highpri                                                                                                                 
- --session <login session id> search based on login session id +     42 root      20              0      0 S   0.0   0.0   0:00.00 kdevtmpfs                                                                                                                                   
- -su,--subject <SE Linux context> search based on context of the Subject +     43 root       -20            0      0 I   0.0   0.0   0:00.00 inet_frag_wq                                                                                                                                
- -sv,--success <Success Value> search based on syscall or event +     44 root      20              0      0 S   0.0   0.0   0:00.01 kauditd                                                                                                                                     
- success value +     45 root      20              0      0 S   0.0   0.0   0:00.13 khungtaskd                                                                                                                                  
- -te,--end [end date] [end time] ending date & time for search +     46 root      20              0      0 S   0.0   0.0   0:00.00 oom_reaper                                                                                                                                  
- -ts,--start [start date] [start time] starting data & time for search +     47 root       -20            0      0 I   0.0   0.0   0:00.00 writeback                                                                                                                                   
- -tm,--terminal <TerMinal> search based on terminal +     48 root      20              0      0 S   0.0   0.0   0:02.29 kcompactd0                                                                                                                                  
- -ua,--uid-all <all User id> search based on All user id's +     49 root      25              0      0 S   0.0   0.0   0:00.00 ksmd                                                                                                                                        
- -ue,--uid-effective <effective User id>  search based on Effective +     50 root      39  19            0      0 S   0.0   0.0   0:00.93 khugepaged                                                                                                                                  
- user id +     51 root       -20            0      0 I   0.0   0.0   0:00.00 cryptd                                                                                                                                      
- -ui,--uid <User Id> search based on user id +     52 root       -20            0      0 I   0.0   0.0   0:00.00 kintegrityd                                                                                                                                 
- -ul,--loginuid <login id> search based on the User's Login id +     53 root       -20            0      0 I   0.0   0.0   0:00.00 kblockd                                                                                                                                     
- -uu,--uuid <guest UUID> search for events related to the virtual +     54 root       0 -20            0      0 I   0.0   0.0   0:00.00 blkcg_punt_bio                                                                                                                              
- machine with the given UUID+     55 root       -20            0      0 I   0.0   0.0   0:00.00 tpm_dev_wq                                                                                                                                  
- -v,--version version +     56 root       -20            0      0 I   0.0   0.0   0:00.00 md                                                                                                                                          
- -vm,--vm-name <guest name> search for events related to the virtual +     57 root       0 -20            0      0 I   0.0   0.0   0:00.00 md_bitmap                                                                                                                                   
- machine with the name+     58 root       -20            0      0 I   0.0   0.0   0:00.00 edac-poller                                                                                                                                 
- -w,--word string matches are whole word +     59 root     -51              0      0 S   0.0   0.0   0:00.00 wat                                    
- -x,--executable <executable name>  search based on executable name+...                                                                         
 </code> </code>
  
-<WRAP center round important 60%> +Pour afficher l'aide de la commande **top**, appuyez sur la touche **h** :
-**Important** : Pour plus d'information concernant le système audit, consultez les manuels de **auditd**, **auditctl**, **audispd**, **aureport** et **ausearch**. +
-</WRAP> +
- +
-=====Le fichier /var/log/messages===== +
- +
-Ce fichier contient la plupart des messages du système :+
  
 <code> <code>
-[root@centos8 ~]# tail -n 15 /var/log/messages +Help for Interactive Commands procps-ng 3.3.17 
-Jun  3 10:15:01 centos8 systemd[1]: session-76.scope: Succeeded. +Window 1:DefCumulative mode Off.  SystemDelay 3.0 secs; Secure mode Off.
-Jun  10:16:01 centos8 systemd[1]: Started Session 77 of user trainee. +
-Jun  10:16:01 centos8 systemd[1]: session-77.scope: Succeeded. +
-Jun  3 10:17:01 centos8 systemd[1]: Started Session 78 of user trainee. +
-Jun  3 10:17:01 centos8 systemd[1]session-78.scopeSucceeded. +
-Jun  3 10:18:01 centos8 systemd[1]: Started Session 79 of user trainee. +
-Jun  10:18:01 centos8 systemd[1]: session-79.scope: Succeeded. +
-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: Succeeded. +
-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: Succeeded. +
-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: Succeeded. +
-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: Succeeded. +
-</code>+
  
-=====Applications=====+  Z,B,E,  Global: 'Z' colors; 'B' bold; 'E'/'e' summary/task memory scale 
 +  l,t,m,  Toggle: 'l' load avg; 't' task/cpu; 'm' memory; 'I' Irix mode 
 +  0,1,2,3,4 Toggle: '0' zeros; '1/2/3' cpu/numa views; '4' cpus two abreast 
 +  f,F,X     Fields: 'f'/'F' add/remove/order/sort; 'X' increase fixed-width
  
-Certaines applications consignent leurs journaux dans des répertoires spécifiquesPar exemple :+  L,&,<,> Locate'L'/'&' find/again; Move sort column: '<'/'>' left/right 
 +  R,H,J,C . Toggle: 'R' Sort; 'H' Threads; 'J' Num justify; 'C' Coordinates 
 +  c,i,S,j . Toggle: 'c' Cmd name/line; 'i' Idle; 'S' Time; 'j' Str justify 
 +  x,y     . Toggle highlights: 'x' sort field; 'y' running tasks 
 +  z,b     . Toggle: 'z' color/mono; 'b' bold/reverse (only if 'x' or 'y'
 +  u,U,o,O . Filter by: 'u'/'U' effective/any user; 'o'/'O' other criteria 
 +  n,#,^O  . Set: 'n'/'#' max tasks displayed; Show: Ctrl+'O' other filter(s) 
 +  V,v     . Toggle: 'V' forest view; 'v' hide/show forest view children
  
-   * cups, +  k,      Manipulate tasks'k' kill; 'r' renice 
-   * httpd, +  d or s    Set update interval 
-   * samba, +  W,Y,!     Write config file 'W'; Inspect other output 'Y'; Combine Cpus '!' 
-   * ... +  q         Quit 
- +          ( commands shown with '.' require a visible task display window )  
-<code> +Press 'h' or '?' for help with Windows, 
-[root@centos8 ~]# ls -l /var/log +Type 'q' or <Esc> to continue 
-total 2448 +
-drwxr-xr-x. 2 root   root      280 May  8  2020 anaconda +
-drwx------. 2 root   root       23 Apr 23  2020 audit +
--rw-------. 1 root   root        0 Jun  3 10:16 boot.log +
--rw-------. 1 root   root    19710 Apr 19 13:44 boot.log-20210419 +
--rw-------. 1 root   root     9548 May 26 09:35 boot.log-20210526 +
--rw-------. 1 root   root     9491 Jun  2 07:40 boot.log-20210602 +
--rw-------. 1 root   root    38555 Jun  3 10:16 boot.log-20210603 +
--rw-rw----. 1 root   utmp     1152 Jun  3 09:51 btmp +
--rw-rw----. 1 root   utmp      384 May 26 10:37 btmp-20210602 +
-drwxr-xr-x. 2 chrony chrony      6 Nov 19  2019 chrony +
--rw-------. 1 root   root    35397 Jun  3 10:22 cron +
--rw-------. 1 root   root     5652 Apr 19 13:01 cron-20210419 +
--rw-------. 1 root   root    16279 May 26 09:01 cron-20210526 +
--rw-------. 1 root   root     5117 Jun  2 07:01 cron-20210602 +
--rw-------1 root   root    13577 Jun  3 10:12 dnf.librepo.log +
--rw-r--r--. 1 root   root    43871 Apr 19 13:15 dnf.librepo.log-20210419 +
--rw-------. 1 root   root    89109 May 26 08:54 dnf.librepo.log-20210526 +
--rw-------. 1 root   root    17737 Jun  2 07:18 dnf.librepo.log-20210602 +
--rw-r--r--. 1 root   root   749350 Jun  3 10:12 dnf.log +
--rw-r--r--. 1 root   root   138497 Jun  3 10:12 dnf.rpm.log +
--rw-r-----. 1 root   root     3808 Jun  3 09:01 firewalld +
-drwxr-xr-x. 2 root   root        6 Nov  3  2020 glusterfs +
--rw-------. 1 root   root      510 Jun  3 09:58 hawkey.log +
--rw-r--r--. 1 root   root      561 Apr 19 12:13 hawkey.log-20210419 +
--rw-------. 1 root   root     3927 May 26 08:54 hawkey.log-20210526 +
--rw-------. 1 root   root      306 Jun  2 06:17 hawkey.log-20210602 +
--rw-rw-r--. 1 root   utmp   293168 Jun  3 09:01 lastlog +
-drwx------. 3 root   root       18 Apr 19 12:07 libvirt +
--rw-------. 1 root   root        0 Jun  2 07:40 maillog +
--rw-------. 1 root   root        0 May  8  2020 maillog-20210419 +
--rw-------. 1 root   root        0 Apr 19 13:44 maillog-20210526 +
--rw-------. 1 root   root        0 May 26 09:35 maillog-20210602 +
--rw-------. 1 root   root   452404 Jun  3 10:22 messages +
--rw-------. 1 root   root   397916 Apr 19 13:15 messages-20210419 +
--rw-------. 1 root   root   173289 May 26 09:19 messages-20210526 +
--rw-------. 1 root   root   123100 Jun  2 07:38 messages-20210602 +
-drwx------. 2 root   root        6 May  8  2020 private +
-drwx------. 3 root   root       17 Aug 17  2020 samba +
--rw-------. 1 root   root     6554 Jun  3 09:51 secure +
--rw-------. 1 root   root    10835 Apr 19 12:07 secure-20210419 +
--rw-------. 1 root   root    11884 May 26 08:49 secure-20210526 +
--rw-------. 1 root   root     3633 Jun  2 06:40 secure-20210602 +
--rw-------. 1 root   root        0 Jun  2 07:40 spooler +
--rw-------. 1 root   root        0 May  8  2020 spooler-20210419 +
--rw-------. 1 root   root        0 Apr 19 13:44 spooler-20210526 +
--rw-------. 1 root   root        0 May 26 09:35 spooler-20210602 +
-drwxr-x---. 2 sssd   sssd      270 Jun  3 10:16 sssd +
-drwxr-xr-x. 3 root   root       21 Apr 19 12:07 swtpm +
-drwxr-xr-x. 2 root   root       23 Jan  4 11:24 tuned +
--rw-rw-r--. 1 root   utmp    34176 Jun  3 09:51 wtmp+
 </code> </code>
  
-=====LAB #2 rsyslog=====+<WRAP center round important> 
 +**Important** Pour revenir à l'affichage précédent, appuyez sur la touche **q** ou **echap**. 
 +</WRAP>
  
-**rsyslog**, le successeur de syslog, centralise les journaux du système grâce au daemon **rsyslog**.  +Au lancement, le temps de rafraîchissement de la liste est de 3 secondesPour modifier ce temps à 1 secondeappuyez sur la touche **s** puis la touche 1 et validez :
- +
-rsyslog apporte des améliorations par rapport à syslogd :  +
- +
-  * l'addition du protocole **TCP** pour la communication, +
-  * la haute disponibilité, +
-  * l'utilisation des bases de données au format MySQL et PostgreSQL pour stocker des journaux +
- +
-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/Priorité s'appelle un **Sélecteur**. +
- +
-rsyslog décide ensuite de l'**action** à entreprendre concernant les informations transmises : +
- +
-  * 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, **/var/log/messages**), +
-  * 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/CentOS, le daemon rsyslog est configuré par l'édition du fichier **/etc/sysconfig/rsyslog** :+
  
 <code> <code>
-[root@centos8 ~]# cat /etc/sysconfig/rsyslog +top - 14:42:15 up 2 days,  1:57,  1 user,  load average: 0.00, 0.00, 0.00 
-# Options for rsyslogd +Tasks: 199 total,   1 running, 198 sleeping,   0 stopped,   0 zombie 
-# Syslogd options are deprecated since rsyslog v3+%Cpu(s):  0.0 us,  0.1 sy,  0.0 ni, 99.9 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st 
-# If you want to use themswitch to compatibility mode 2 by "-c 2" +MiB Mem :   7685.1 total  4518.6 free,   1105.4 used,   2375.3 buff/cache 
-# See rsyslogd(8) for more details +MiB Swap:   5120.0 total,   5120.0 free,      0.0 used.   6579.avail Mem  
-SYSLOGD_OPTIONS=""+Change delay from 3.0 to 1 
 +...
 </code> </code>
  
-L'option **-c** de la directive **SYSLOGD_OPTIONS** spécifie le niveau de compatibilité avec les anciennes versions de rsyslog ainsi qu'avec son prédécesseur syslogd :+Pour trier la liste selon l'utilisation de la mémoire, appuyez sur la touche **M** :
  
-^ Directive ^ Version ^ +<code> 
-| SYSLOGD_OPTIONS="-c 4" | Mode natif - aucune compatibilité | +[root@redhat9 ~]# top 
-| SYSLOGD_OPTIONS="-2" | rsyslog V2 - mode compatibilité | +top 14:43:12 up days,  1:58,  1 user,  load average: 0.00, 0.00, 0.00 
-| SYSLOGD_OPTIONS="-c 0" | syslogd |+Tasks: 199 total,   1 running, 198 sleeping,   0 stopped,   0 zombie 
 +%Cpu(s):  0.0 us,  0.0 sy,  0.0 ni,100.0 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st 
 +MiB Mem :   7685.1 total,   4518.6 free,   1105.4 used,   2375.3 buff/cache 
 +MiB Swap:   5120.0 total,   5120.0 free,      0.used.   6579.8 avail Mem 
  
-====2.1 - Priorités====+    PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND                                                                                                                                     
 +   6049 gdm       20   0 4453852 242772 120572 S   0.0   3.1   0:23.39 gnome-shell                                                                                                                                 
 +   6617 gdm       20    578604  54332  46592 S   0.0   0.7   0:00.05 ibus-x11                                                                                                                                    
 +   6206 gdm       20    166808  45312  38144 S   0.0   0.6   0:00.05 Xwayland                                                                                                                                    
 +   5707 root      20    350204  44404  18884 S   0.0   0.6   0:00.38 firewalld                                                                                                                                   
 +   6444 gdm       20    678348  33608  21888 S   0.0   0.4   0:00.44 gsd-color                                                                                                                                   
 +   5675 polkitd   20   0 2713852  31804  19792 S   0.0   0.4   0:00.54 polkitd                                                                                                                                     
 +   6462 gdm       20    661452  29948  22276 S   0.0   0.4   0:00.13 gsd-media-keys                                                                                                                              
 +   6674 gdm       20   0 2866068  28596  21120 S   0.0   0.4   0:00.06 gjs                                                                                                                                         
 +   6486 gdm       20    665628  28568  20996 S   0.0   0.4   0:00.12 gsd-power                                                                                                                                   
 +   6432 gdm       20   0 2931604  27964  20864 S   0.0   0.4   0:00.06 gjs                                                                                                                                         
 +   6439 gdm       20    590924  27396  19716 S   0.0   0.3   0:00.12 gsd-wacom                                                                                                                                   
 +   6451 gdm       20    590224  26680  19584 S   0.0   0.3   0:00.10 gsd-keyboard                                                                                                                                
 +   6571 gdm       20    598424  24032  17280 S   0.0   0.3   0:00.02 gsd-printer                                                                                                                                 
 +    853 root      20    475084  23056  18120 S   0.0   0.3   0:04.02 NetworkManager                                                                                                                              
 +   5975 gdm       20    734740  22260  15744 S   0.0   0.3   0:00.10 gnome-session-b                                                                                                                             
 +   7620 apache    20   0 2423380  21372   5632 S   0.0   0.3   0:14.02 httpd                                                                                                                                       
 +   7431 apache    20   0 2423380  21316   5632 S   0.0   0.3   0:14.10 httpd                                                                                                                                       
 +   6455 gdm       20    594384  20668  16128 S   0.0   0.3   0:00.04 gsd-datetime                                                                                                                                
 +   7898 apache    20   0 2357844  19356   5632 S   0.0   0.  0:13.86 httpd                                                                                                                                       
 +      root      20    190992  17880  10644 S   0.0   0.2   0:13.89 systemd                                                                                                                                     
 +   7621 apache    20   0 2226708  17344   5760 S   0.0   0.2   0:12.83 httpd                                                                                                                                       
 +   7899 apache    20   0 2226708  17292   5760 S   0.0   0.2   0:11.94 httpd                                                                                                                                       
 +   7432 apache    20   0 2226708  17240   5632 S   0.0   0.2   0:12.81 httpd                                                                                                                                       
 +   7622 apache    20   0 2161172  17236   5760 S   0.0   0.2   0:12.70 httpd                                                                                                                                       
 +   7433 apache    20   0 2226708  17196   5632 S   0.0   0.2   0:12.77 httpd                                                                                                                                       
 +   7900 apache    20   0 2226708  17096   5632 S   0.0   0.2   0:12.27 httpd                                                                                                                                       
 +   6381 gdm        9 -11  545148  16128  12800 S   0.0   0.2   0:00.05 wireplumber                                                                                                                                 
 +   5742 root      20    395124  15672  11636 S   0.0   0.2   0:00.13 udisksd                                                                                                                                     
 +   6452 gdm       20    467300  14876  11136 S   0.0   0.2   0:00.02 gsd-print-notif                                                                                                                             
 +   6640 colord    20    530424  14164   9980 S   0.0   0.2   0:00.06 colord                                                                                                                                      
 +   5851 gdm       20     22976  13936  10752 S   0.0   0.2   0:00.11 systemd                                                                                                                                     
 +   9365 trainee   20     22984  13812  10624 S   0.0   0.2   0:00.09 systemd                                                                                                                                     
 +   6454 gdm       20    603444  13636  10112 S   0.0   0.2   0:04.03 gsd-smartcard                                                                                                                               
 +   6477 gdm       20    530684  13456   8320 S   0.0   0.2   0:00.01 gsd-sound                                                                                                                                   
 +   6599 gdm       20    600368  13304   6656 S   0.0   0.2   0:00.07 ibus-daemon                                                                                                                                 
 +    629 root      20     36112  13120   9216 S   0.0   0.2   0:00.48 systemd-udevd                                                                                                                               
 +   5787 root      20    387252  13092   9472 S   0.0   0.2   0:00.02 gdm-session-wor                                                                                                                             
 +   6436 gdm       20    678244  12720   9216 S   0.0   0.2   0:00.01 gsd-sharing                                                                                                                                 
 +   5704 root      20    391468  12632  10712 S   0.0   0.2   0:00.05 ModemManager                                                                                                                                
 +   6482 gdm       20    524704  12100   7168 S   0.0   0.2   0:01.08 gsd-housekeepin                                                                                                                             
 +   7429 root      20     20368  11608   9176 S   0.0   0.1   0:04.09 httpd                                                                                                                                       
 +   7618 root      20     20368  11540   9108 S   0.0   0.1   0:04.28 httpd                                                                                                                                       
 +   6377 gdm        9 -11  326096  11520   8192 S   0.0   0.1   0:00.02 pipewire                                                                                                                                    
 +   5671 root      20     21044  11480   9088 S   0.0   0.1   0:02.60 systemd-logind                                                                                                                              
 +   7896 root      20     20368  11464   9032 S   0.0   0.1   0:04.17 httpd                                                                                                                                       
 +   9357 root      20     19432  11264   9600 S   0.0   0.1   0:00.02 sshd                                                                                                                                        
 +   5736 root      20    247824  11136   9088 S   0.0   0.1   0:00.04 cupsd                                                                                                                                       
 +    614 root      20     27084  10880   9728 S   0.0   0.1   0:00.88 systemd-journal                                                                                                                             
 +   5765 root      20    453120  10828   7808 S   0.0   0.1   0:00.02 gdm          
 +...                                                         
 +</code>
  
-La **Priorité** permet d'indiquer à rsyslog l'importance des informations :+Pour ne pas visualiser les processus zombies ou les processus en attente, appuyez sur la touche i :
  
-^ Niveau ^ Priorité ^ Description ^ +<code> 
-| emerg/panic | Système inutilisable | +[root@redhat9 ~]# top 
-| alert | Action immédiate requise | +top - 14:44:10 up 2 days,  1:59,  1 user,  load average: 0.00, 0.00, 0.00 
-| crit | Condition critique atteinte | +Tasks: 199 total,   running, 198 sleeping,   0 stopped,   0 zombie 
-| err/error | Erreurs rencontrées | +%Cpu(s):  0.5 us,  0.0 sy,  0.0 ni, 99.3 id,  0.0 wa,  0.hi,  0.0 si,  0.0 st 
-| 4 | warning/warn | Avertissements présentés | +MiB Mem :   7685.1 total,   4518.6 free,   1105.4 used,   2375.buff/cache 
-| 5 | notice | Condition normale - message important | +MiB Swap:   5120.0 total,   5120.0 free,      0.0 used.   6579.8 avail Mem 
-| 6 | info | Condition normale - message simple | +
-| 7 | debug | Condition normale - message de débogage | +
  
-====2.Sous-systèmes applicatifs====+    PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND                                                                                                                                     
 +   6049 gdm       20   0 4458012 242772 120572 S   1.0   3.1   0:23.41 gnome-shell                                                                                                                                 
 +  10744 root      20    226032   4096   3328 R   1.0   0.1   0:00.59 top                                                                                                                                             
 +</code>
  
-Le **Sous-système applicatif**aussi appelé **facility**, permet d'indiquer à rsyslog le type de programme qui envoie les informations :+Pour quitter topappuyez sur la touche **q**.
  
-^ Fonction ^ Description ^ +Les options de cette commande sont :
-| auth/auth-priv | Message de sécurité / autorisation | +
-| cron | Message de cron ou at | +
-| daemon | Message d'un daemon | +
-| kern | Message du noyau | +
-| lpr | Message du système d'impression | +
-| 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 - /etc/rsyslog.conf==== +
- +
-rsyslog est configuré par le fichier **/etc/rsyslog.conf** :+
  
 <code> <code>
-[root@centos8 ~]# cat /etc/rsyslog.conf +[root@redhat9 ~]# top --help 
-# rsyslog configuration file +topinappropriate '-help' 
- +Usage
-# For more information see /usr/share/doc/rsyslog-*/rsyslog_conf.html +  top -hv | -bcEeHiOSs1 -d secs -n max -u|U user -p pid(s) -o field -w [cols]
-# or latest version online at http://www.rsyslog.com/doc/rsyslog_conf.html  +
-# If you experience problems, see http://www.rsyslog.com/doc/troubleshoot.html +
- +
-#### MODULES #### +
- +
-module(load="imuxsock"   # provides support for local system logging (e.g. via logger command) +
-       SysSock.Use="off") # Turn off message reception via local log socket;  +
-   # local messages are retrieved through imjournal now. +
-module(load="imjournal"     # provides access to the systemd journal +
-       StateFile="imjournal.state") # File to store the position in the journal +
-#module(load="imklog") # reads kernel messages (the same are read from journald) +
-#module(load="immark") # provides --MARK-- message capability +
- +
-# Provides UDP syslog reception +
-# for parameters see http://www.rsyslog.com/doc/imudp.html +
-#module(load="imudp") # needs to be done just once +
-#input(type="imudp" port="514"+
- +
-# Provides TCP syslog reception +
-# for parameters see http://www.rsyslog.com/doc/imtcp.html +
-#module(load="imtcp") # needs to be done just once +
-#input(type="imtcp" port="514"+
- +
-#### GLOBAL DIRECTIVES #### +
- +
-# Where to place auxiliary files +
-global(workDirectory="/var/lib/rsyslog"+
- +
-# Use default timestamp format +
-module(load="builtin:omfile" Template="RSYSLOG_TraditionalFileFormat"+
- +
-# Include all config files in /etc/rsyslog.d+
-include(file="/etc/rsyslog.d/*.conf" mode="optional"+
- +
-#### RULES #### +
- +
-# Log all kernel messages to the console. +
-# Logging much else clutters up the screen. +
-#kern.*                                                 /dev/console +
- +
-# Log anything (except mail) of level info or higher. +
-# Don't log private authentication messages! +
-*.info;mail.none;authpriv.none;cron.none                /var/log/messages +
- +
-# The authpriv file has restricted access. +
-authpriv.*                                              /var/log/secure +
- +
-# Log all the mail messages in one place. +
-mail.*                                                  -/var/log/maillog +
- +
- +
-# Log cron stuff +
-cron.*                                                  /var/log/cron +
- +
-# Everybody gets emergency messages +
-*.emerg                                                 :omusrmsg:+
- +
-# Save news errors of level crit and higher in a special file. +
-uucp,news.crit                                          /var/log/spooler +
- +
-# Save boot messages also to boot.log +
-local7.*                                                /var/log/boot.log +
- +
- +
-# ### sample forwarding rule ### +
-#action(type="omfwd"   +
-# 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. +
-#queue.filename="fwdRule1"       # unique name prefix for spool files +
-#queue.maxdiskspace="1g"         # 1gb space limit (use as much as possible) +
-#queue.saveonshutdown="on"       # save messages to disk on shutdown +
-#queue.type="LinkedList"         # run asynchronously +
-#action.resumeRetryCount="-1"    # infinite retries if host is down +
-# Remote Logging (we use TCP for reliable delivery) +
-# remote_host is: name/ip, e.g. 192.168.0.1, port optional e.g. 10514 +
-#Target="remote_host" Port="XXX" Protocol="tcp")+
 </code> </code>
  
-Ce fichier est divisé en 3 parties :+====1.5 - Les Commandes fg, bg et jobs====
  
-  * **Modules**, +Normalement les commandes s’exécutent en avant plan. Vous pouvez également lancer des processus en arrière plan (en tâche de fond). Si vous lancez une commande en tâche de fondil faut rajouter **(espace)&** à la fin de la commande :
-    * 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** (//Rules//)+
-    * Section traitant les règles de configuration des journauxLes 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 rsyslogla réception des données par ce dernier appelée les **inputs** est gérée par l'utilisation de modules. Parmi les modules les plus fréquemment utilisés, on trouve : +
- +
-^ Module ^ Fonction ^ +
-| module(load="imuxsock" SysSock.Use="off"| Active la trace des messages locaux, per exemple de la commande **logger** | +
-| module(load="imjournal" StateFile="imjournal.state") | Fournit un accès au journal **systemd** | +
-| module(load="imklog") | Active la trace de messages du **noyau** | +
-| module(load="immark") | Active la trace des messages de type **mark** | +
-| module(load="imudp") | Active la réception de messages en utilisant le protocole **UDP** | +
-| module(load="imtcp") | Active la réception de messages en utilisant le protocole **TCP** | +
- +
-Dans le fichier **/etc/rsyslog.conf** nous pouvons constater que les inputs **module(load="imuxsock" SysSock.Use="off")** et **module(load="imjournal" StateFile="imjournal.state")** sont activés :+
  
 <file> <file>
-... +sleep 9999 &
-#### MODULES #### +
- +
-module(load="imuxsock"   # provides support for local system logging (e.g. via logger command) +
-       SysSock.Use="off") # Turn off message reception via local log socket;  +
-   # local messages are retrieved through imjournal now. +
-module(load="imjournal"     # provides access to the systemd journal +
-       StateFile="imjournal.state") # File to store the position in the journal +
-#module(load="imklog") # reads kernel messages (the same are read from journald) +
-#module(load="immark") # provides --MARK-- message capability +
- +
-# Provides UDP syslog reception +
-# for parameters see http://www.rsyslog.com/doc/imudp.html +
-#module(load="imudp") # needs to be done just once +
-#input(type="imudp" port="514"+
- +
-# Provides TCP syslog reception +
-# for parameters see http://www.rsyslog.com/doc/imtcp.html +
-#module(load="imtcp") # needs to be done just once +
-#input(type="imtcp" port="514"+
-...+
 </file> </file>
  
-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 **/etc/rsyslog.conf** et de re-démarrer le service :+<WRAP center round important> 
 +Notez qu’un processus en arrière plan est dit **asynchrone** car il se poursuit indépendamment de son parent qui est le shell. En avant plan le processus est dit **synchrone**
 +</WRAP>
  
-<file> +Linux numérote tous les processus qui sont placés en tâches de fondOn parle donc d’un **numéro de tâche**.
-..+
-# Provides UDP syslog reception +
-# for parameters see http://www.rsyslog.com/doc/imudp.html +
-module(load="imudp") # needs to be done just once +
-input(type="imudp" port="514")+
  
-# Provides TCP syslog reception +La commande **jobs** permet de se renseigner sur les processus en arrière plan :
-# for parameters see http://www.rsyslog.com/doc/imtcp.html +
-module(load="imtcp") # needs to be done just once +
-input(type="imtcp" port="514"+
-... +
-</file>+
  
-<WRAP center round important 60%+<code
-**Important** : Les deux directives **module(load="imudp")** et **input(type="imudp" port="514")** crée un ** Écouteur** sur le port UDP/514 tandis que les deux directives **module(load="imtcp")** et **input(type="imtcp" port="514")** crée un Écouteur sur le port TCP/514. Le port 514 est le port standard pour les Écouteurs de rsyslog. Cependant il est possible de modifier le numéro du port. +[root@redhat9 ~]# sleep 9999 & 
-</WRAP>+[1] 10749
  
-Pour envoyer l'ensemble des traces de journalisation vers un serveur rsyslog distant, il convient de décommenter et modifier une ligne dans la section suivante du fichier **/etc/rsyslog.conf** : +[root@redhat9 ~]jobs -l 
- +[1]+ 10749 Running                 sleep 9999 & 
-<file> +</code>
-... +
-### sample forwarding rule ### +
-#action(type="omfwd"   +
-# 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. +
-#queue.filename="fwdRule1"       # unique name prefix for spool files +
-#queue.maxdiskspace="1g"         # 1gb space limit (use as much as possible) +
-#queue.saveonshutdown="on"       # save messages to disk on shutdown +
-#queue.type="LinkedList"         # run asynchronously +
-#action.resumeRetryCount="-1   # infinite retries if host is down +
-# Remote Logging (we use TCP for reliable delivery) +
-# remote_host is: name/ip, e.g. 192.168.0.1, port optional e.g. 10514 +
-Target="remote_host" Port="514" Protocol="tcp"+
-... +
-</file>+
  
-<WRAP center round important 60%+<WRAP center round important> 
-**Important** : Ces directives utilisent le protocole TCP. Le serveur distant doit donc être configuré pour ce mode de communicationLa directive **Target="remote_host" Port="514" Protocol="tcp")** doit être modifiée pour indiquer l'adresse IP du serveur rsyslog distant.+**Important** - Notez que le numéro de tâche est indiqué entre [crochets] tandis que le PID ne l'est pasLe signe **+** qui suit le numéro de tâche [1] indique que la tâche est la dernière a avoir été manipulée.
 </WRAP> </WRAP>
  
-===Directives Globales===+Si on souhaite envoyer un processus en arrière plan de façon à libérer le shell pour d’autres commandes, il faut d’abord suspendre le processus en question. Normalement on suspend un processus en utilisant la combinaison de touches <key>Ctrl</key><key>Z</key>.
  
-Les directives dans cette section servent à configurer le comportement de rsyslog. Par exemple, nous pouvons constater la présence de la directive suivante :+Par exemple :
  
-<file+<code
-module(load="builtin:omfile" Template="RSYSLOG_TraditionalFileFormat") +[root@redhat9 ~]# sleep 1234 
-</file>+^Z 
 +[2]+  Stopped                 sleep 1234 
 +</code>
  
-Cette directive stipule que le format des entrées dans les fichiers de journalisation **ne doit pas** être au format d'horodatage étendu de rsyslog qui offre plus de précision que le format de syslog classique.+Un fois suspendu, on utilise la commande **bg** (background) suivi par **%** et le numéro de tâche pour envoyer le processus en arrière plan :
  
-===Règles===+<code> 
 +[root@redhat9 ~]# bg %2 
 +[2]+ sleep 1234 &
  
-Chaque règle prend la forme suivante :+[root@redhat9 ~]# jobs -l 
 +[1]- 10749 Running                 sleep 9999 & 
 +[2]+ 10750 Running                 sleep 1234 & 
 +</code>
  
-<file+<WRAP center round important
-Sélecteur[; ... [-] Action +**Important** - Notez que lors du passage en arrière plan, le processus reprend son exécution normalement. Le caractère **-** qui suit le numéro de tâche [1indique que la tâche est l'avant-dernière a avoir été manipulée. 
-</file>+</WRAP>
  
-Un Sélecteur est défini d'une des façons suivantes :+Pour ramener le processus en avant plan, il faut de nouveau interrompre le processus concerné. Or cette fois-ci, nous ne pouvons pas utiliser la commande <key>Ctrl</key><key>Z</key>. Il faut donc envoyer un **signal** au processus en utilisant la commande **kill** avec l’opérateur **–stop**.
  
-==Sous-système applicatif.Priorité==+<code> 
 +[root@redhat9 ~]# kill -s stop %2
  
-Dans ce cas on ne tient compte que des messages de priorité égale ou supérieure à la Priorité indiquée.+[2]+  Stopped                 sleep 1234 
 +</code>
  
-==Sous-système applicatif!Priorité==+Pour ramener le processus en avant plan, on utilise la commande fg : 
  
-Dans ce cas on ne tient compte que des messages de priorité inférieure à la Priorité indiquée.+<code> 
 +[root@redhat9 ~]# fg %2 
 +sleep 1234 
 +^C 
 +</code>
  
-==Sous-système applicatif=Priorité==+<WRAP center round important> 
 +**Important** Notez l'utilisation des touches <key>Ctrl</key><key>c</key> pour tuer le processus en avant plan. 
 +</WRAP>
  
-Dans ce cas on ne tient compte que des messages de priorité égale à la Priorité indiquée.+Les options de la commande jobs sont :
  
-==L'utilisation du caractère spécial *==+<code> 
 +[root@redhat9 ~]# help jobs 
 +jobs: jobs [-lnprs] [jobspec ...] or jobs -x command [args] 
 +    Display status of jobs. 
 +     
 +    Lists the active jobs.  JOBSPEC restricts output to that job. 
 +    Without options, the status of all active jobs is displayed. 
 +     
 +    Options: 
 +      -l        lists process IDs in addition to the normal information 
 +      -n        lists only processes that have changed status since the last 
 +                notification 
 +      -p        lists process IDs only 
 +      -r        restrict output to running jobs 
 +      -s        restrict output to stopped jobs 
 +     
 +    If -x is supplied, COMMAND is run after all job specifications that 
 +    appear in ARGS have been replaced with the process ID of that job'
 +    process group leader. 
 +     
 +    Exit Status: 
 +    Returns success unless an invalid option is given or an error occurs. 
 +    If -x is used, returns the exit status of COMMAND. 
 +</code>
  
-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, par exemple : **cron.***.+====1.La Commande wait====
  
-==n Sous-systèmes avec la même priorité==+Cette commande permet de doter un processus asynchrone du comportement d'un processus synchrone. Elle est utilisée pour attendre jusqu’à ce qu'un processus en tâche de fond soit terminé :
  
-Plusieurs Sous-systèmes applicatifs peuvent être stipulés pour la même Priorité en les séparant avec un **virgule**. Par exemple : **uucp,news.crit**.+<code> 
 +[root@redhat9 ~]# jobs -
 +[1]+ 10749 Running                 sleep 9999 &
  
-==n Sélecteurs avec la même Action== +[root@redhat9 ~]# wait %1 
- +^C
-Une Action peut s'appliquer à plusieurs Sélecteurs en les séparant par le caractère **;**, par exemple : ***.info;mail.none;authpriv.none;cron.none**.+
  
 +[root@redhat9 ~]# jobs -l
 +[1]+ 10749 Running                 sleep 9999 &
 +</code>
  
-<WRAP center round important 60%+<WRAP center round important> 
-**Important** : Une Action précédée par le signe **-** est entreprise d'une manière **asynchrone**. Dans le cas ou l'action est entreprise d'une manière **synchrone**, la pertinence des journaux est garantie mais au prix d'un ralentissement du système.+**Important** - Notez que l'utilisation des touches <key>Ctrl</key><key>c</key> tue le processus généré par la commande **wait** et non le processus généré par la commande **sleep**.
 </WRAP> </WRAP>
  
-=====LAB #3 - La Commande logger=====+====1.7 - La Commande nice====
  
-La commande **/usr/bin/logger** permet d'intégrer des informations dans rsyslogCeci peut s'avérer utile dans des scripts bash.+Cette commande affiche ou modifie la priorité d’un processusLa priorité par défaut de nice est 10La valeur de nice la plus prioritaire est -20. La valeur la moins prioritaire est 19 :
  
-La syntaxe de la commande est :+<code> 
 +[root@redhat9 ~]# nice -n -20 sleep 1234 
 +^Z 
 +[2]+  Stopped                 nice -n -20 sleep 1234
  
-<file> +[root@redhat9 ~]# ps lx | grep sleep 
-logger -p Sous-système applicatif.Priorité message +0       10749   10066  20   0 220952  1792 hrtime S    pts/0      0:00 sleep 9999 
-</file>+4       10775   10066   0 -20 220952  1792 do_sig T  pts/0      0:00 sleep 1234 
 +0       10777   10066  20   0 221664  2304 pipe_r S+   pts/     0:00 grep --color=auto sleep
  
-Par exemple saisissez la commande suivante :+[root@redhat9 ~]# nice -n 19 sleep 5678 
 +^Z 
 +[3]+  Stopped                 nice -n 19 sleep 5678
  
-<code> +[root@redhat9 ~]# ps lx | grep sleep 
-[root@centos8 ~]# logger -p user.info Linux est super+0       10749   10066  20   0 220952  1792 hrtime S    pts/0      0:00 sleep 9999 
 +4       10775   10066   0 -20 220952  1792 do_sig T<   pts/     0:00 sleep 1234 
 +0       10778   10066  39  19 220952  1792 do_sig TN   pts/     0:00 sleep 5678 
 +0       10780   10066  20   0 221664  2304 pipe_r S+   pts/     0:00 grep --color=auto sleep
 </code> </code>
  
-Consultez la fin de votre syslog :+Comme vous pouvez constater la 6ième colonne contient la valeur de nice qui s'applique à la priorité dans la colonne 5. 
  
-<code+<WRAP center round important
-[root@centos8 ~]# tail /var/log/messages +**Important** - Notez que seul root peut lancer des processus avec une valeur négative
-Jun  3 12:55:01 centos8 systemd[1]: session-237.scope: Succeeded. +</WRAP>
-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: Succeeded. +
-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: Succeeded. +
-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: Succeeded. +
-Jun  3 12:58:55 centos8 trainee[5139]: Linux est super +
-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: Succeeded+
-</code>+
  
-Les options de la commande logger sont :+Les options de cette commande sont :
  
 <code> <code>
-[root@centos8 ~]# logger --help+[root@redhat9 ~]# nice --help 
 +Usage: nice [OPTION] [COMMAND [ARG]...] 
 +Run COMMAND with an adjusted niceness, which affects process scheduling. 
 +With no COMMAND, print the current niceness.  Niceness values range from 
 +-20 (most favorable to the process) to 19 (least favorable to the process).
  
-Usage: +Mandatory arguments to long options are mandatory for short options too
- logger [options] [<message>+  -n, --adjustment=  add integer N to the niceness (default 10
- +      --help     display this help and exit 
-Enter messages into the system log+      --version  output version information and exit
- +
-Options: +
- -i                       log the logger command's PID +
-     --id[=<id>         log the given <id>, or otherwise the PID +
- -f, --file <file>        log the contents of this file +
- -e, --skip-empty         do not log empty lines when processing files +
-     --no-act             do everything except the write the log +
- -p, --priority <prio>    mark given message with this priority +
-     --octet-count        use rfc6587 octet counting +
-     --prio-prefix        look for a prefix on every line read from stdin +
- -s, --stderr             output message to standard error as well +
- -S, --size <size>        maximum size for a single message +
- -t, --tag <tag>          mark every line with this tag +
- -n, --server <name>      write to this remote syslog server +
- -P, --port <port>        use this port for UDP or TCP connection +
- -T, --tcp                use TCP only +
- -d, --udp                use UDP only +
-     --rfc3164            use the obsolete BSD syslog protocol +
-     --rfc5424[=<snip>  use the syslog protocol (the default for remote); +
-                            <snip> can be notime, or notq, and/or nohost +
-     --sd-id <id>         rfc5424 structured data ID +
-     --sd-param <data>    rfc5424 structured data name=value +
-     --msgid <msgid>      set rfc5424 message id field +
- -u, --socket <socket>    write to this Unix socket +
-     --socket-errors[=<on|off|auto>+
-                          print connection errors when using Unix sockets +
-     --journald[=<file> write journald entry+
  
- -h--help               display this help +NOTE: your shell may have its own version of nicewhich usually supersedes 
- -V, --version            display version+the version described here.  Please refer to your shell's documentation 
 +for details about the options it supports.
  
-For more details see logger(1).+GNU coreutils online help: <https://www.gnu.org/software/coreutils/> 
 +Full documentation <https://www.gnu.org/software/coreutils/nice> 
 +or available locally via: info '(coreutilsnice invocation'
 </code> </code>
  
-=====LAB #4 - La Commande logrotate=====+====1.8 - La Commande renice====
  
-Les fichiers journaux grossissent régulièrementLe programme **/usr/sbin/logrotate** est utilisé pour effectuer des rotations de ces fichiers selon la configuration contenue dans le fichier **/etc/logrotate.conf**. +Cette commande modifie la priorité d’un processus déjà en coursLa valeur de la priorité ne peut être modifiée que par le propriétaire du processus ou par root.
- +
-Visualisez le fichier **/etc/logrotate.conf** :+
  
 <code> <code>
-[root@centos8 ~]# cat /etc/logrotate.conf +[root@redhat9 ~]# jobs -l 
-# see "man logrotate" for details +[1]  10749 Running                 sleep 9999 & 
-# rotate log files weekly +[2]- 10775 Stopped                 nice -n -20 sleep 1234 
-weekly+[3]+ 10778 Stopped                 nice -n 19 sleep 5678
  
-keep 4 weeks worth of backlogs +[root@redhat9 ~]bg %2 
-rotate 4+[2]- nice -n -20 sleep 1234 &
  
-create new (empty) log files after rotating old ones +[root@redhat9 ~]bg %3 
-create+[3]+ nice -n 19 sleep 5678 &
  
-use date as a suffix of the rotated file +[root@redhat9 ~]jobs -l 
-dateext+[1]  10749 Running                 sleep 9999 & 
 +[2]- 10775 Running                 nice -n -20 sleep 1234 & 
 +[3]+ 10778 Running                 nice -n 19 sleep 5678 &
  
-uncomment this if you want your log files compressed +[root@redhat9 ~]renice +5 10775 
-#compress+10775 (process ID) old priority -20, new priority 5
  
-RPM packages drop log rotation information into this directory +[root@redhat9 ~]renice -5 10778 
-include /etc/logrotate.d+10778 (process ID) old priority 19, new priority -5
  
-system-specific logs may be also be configured here.+[root@redhat9 ~]ps lx | grep sleep 
 +0       10749   10066  20   0 220952  1792 hrtime S    pts/0      0:00 sleep 9999 
 +4       10775   10066  25   5 220952  1792 do_sys SN   pts/     0:00 sleep 1234 
 +0       10778   10066  15  -5 220952  1792 do_sys S<   pts/     0:00 sleep 5678 
 +0       10790   10066  20   0 221796  2304 pipe_r S+   pts/     0:00 grep --color=auto sleep
 </code> </code>
  
-Dans la première partie de ce fichier on trouve des directives pour : +<WRAP center round important> 
- +**Important** -Notez que seul root peut décrémenter la valeur de priorité avec la commande renice.
-  * 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 /etc/logrotate.d** indique que les configurations incluent dans le répertoire cité doivent être incorporées dans le fichier de configuration de logrotate. +
- +
-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.+
 </WRAP> </WRAP>
  
-Les options de la commande logrotate sont :+Les options de cette commande sont :
  
 <code> <code>
-[root@centos8 ~]# logrotate --help +[root@redhat9 ~]# renice --help
-Usage: logrotate [OPTION...] <configfile> +
-  -d, --debug               Don't do anything, just test and print debug +
-                            messages +
-  -f, --force               Force file rotation +
-  -m, --mail=command        Command to send mail (instead of `/bin/mail'+
-  -s, --state=statefile     Path of state file +
-  -v, --verbose             Display messages during rotation +
-  -l, --log=logfile         Log file or 'syslog' to log to syslog +
-      --version             Display version information+
  
-Help options+Usage
-  -?, --help                Show this help message + renice [-n] <priority> [-p|--pid] <pid>... 
-      --usage               Display brief usage message + renice [-n] <priority>  -g|--pgrp <pgid>... 
-</code>+ renice [-n] <priority>  -u|--user <user>...
  
-=====LAB #5 - La Journalisation avec journald=====+Alter the priority of running processes.
  
-Sous RHEL/CentOS 8les fichiers de Syslog sont gardés pour une question de compatibilité. Cependanttous les journaux sont d'abord collectés par **Journald** pour ensuite être redistribués vers les fichiers classiques se trouvant dans le répertoire /var/log. Les journaux de journald sont stockés dans un seul et unique fichier dynamique dans le répertoire **/run/log/journal** :+Options: 
 + -n--priority <num>   specify the nice value 
 + -p--pid              interpret arguments as process ID (default) 
 + -g, --pgrp             interpret arguments as process group ID 
 + -u, --user             interpret arguments as username or user ID
  
-<code> + -h, --help             display this help 
-[root@centos8 ~]# ls -l /run/log/journal/ + -V, --version          display version
-total 0 +
-drwxr-s---+ 2 root systemd-journal 60 Jun  3 09:01 de79af4f226d480fa7d3fec4cabbf97a +
-</code>+
  
-A l'extinction de la machine les journaux sont **effacés**. +For more details see renice(1).
- +
-Pour rendre les journaux permenants, il faut créer le répertoire **/var/log/journal** : +
- +
-<code> +
-[root@centos8 ~]# mkdir /var/log/journal +
-[root@centos8 ~]# ls -l /var/log/journal/ +
-total 0 +
-[root@centos8 ~]# systemctl restart systemd-journald +
-[root@centos8 ~]# ls -l /run/log/journal/ +
-ls: cannot access '/run/log/journal/': No such file or directory +
-[root@centos8 ~]# ls -l /var/log/journal/ +
-total 0 +
-drwxr-xr-x. 2 root root 28 Jun  3 13:03 de79af4f226d480fa7d3fec4cabbf97a+
 </code> </code>
  
-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, **/etc/systemd/journald.conf**, puis configurer Rsyslog à envoyer les traces au serveur distant :+====1.9 - La Commande nohup====
  
-<code> +Cette commande permet à un processus de poursuivre son exécution après la déconnexionUn processus enfant meurt quand le processus parent meure ou se termineComme une connexion est un processus, quand vous vous déconnectez, vos processus se terminentPour éviter de rester connecté après avoir lancé un processus longvous utiliserez la commande nohup :
-[root@centos8 ~]# cat /etc/systemd/journald.conf +
-#  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 Licenseor +
-#  (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] +<file> 
-#Storage=auto +nohup lp ventes.txt & 
-#Compress=yes +</file>
-#Seal=yes +
-#SplitMode=uid +
-#SyncIntervalSec=5m +
-#RateLimitIntervalSec=30s +
-#RateLimitBurst=10000 +
-#SystemMaxUse= +
-#SystemKeepFree= +
-#SystemMaxFileSize= +
-#SystemMaxFiles=100 +
-#RuntimeMaxUse= +
-#RuntimeKeepFree= +
-#RuntimeMaxFileSize= +
-#RuntimeMaxFiles=100 +
-#MaxRetentionSec= +
-#MaxFileSec=1month +
-#ForwardToSyslog=no +
-ForwardToSyslog=yes +
-#ForwardToKMsg=no +
-#ForwardToConsole=no +
-#ForwardToWall=yes +
-#TTYPath=/dev/console +
-#MaxLevelStore=debug +
-#MaxLevelSyslog=debug +
-#MaxLevelKMsg=notice +
-#MaxLevelConsole=info +
-#MaxLevelWall=emerg +
-#LineMax=48K +
-</code>+
  
-====5.1 - Consultation des Journaux==== +Les options de cette commande sont :
- +
-L'utilisation de la commande **journalctl** permet la consultation des journaux :+
  
 <code> <code>
-[root@centos8 ~]# journalctl +[root@redhat9 ~]# nohup --help 
--- Logs begin at Thu 2021-06-03 09:01:10 EDT, end at Thu 2021-06-03 13:08:01 EDT. -- +Usagenohup COMMAND [ARG]... 
-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 +  or:  nohup OPTION 
-Jun 03 09:01:10 centos8.ittraining.loc kernel: Command line: BOOT_IMAGE=(hd0,msdos1)/vmlinuz-4.18.0-240.22.1.el8_3.x86_64 root=UUID=4c0cc28c-0d59-45be-bd73-d292b80be33c ro crashkernel=auto resume=UUID=c8bb3f47-d67f-4b21-b781-766899dc83d4> +Run COMMANDignoring hangup signals.
-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]:  576, xstate_sizes[2]:  256 +
-Jun 03 09:01:10 centos8.ittraining.loc kernel: x86/fpu: Enabled xstate features 0x7, context size is 832 bytes, using 'standard' format+
-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/VirtualBox, BIOS VirtualBox 12/01/2006 +
-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: kvm-clock: mask: 0xffffffffffffffff max_cycles: 0x1cd42e4dffb, max_idle_ns: 881590591483 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 +
-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 [0x114a010000x114a01fff] PGTABLE +
-Jun 03 09:01:10 centos8.ittraining.loc kernel: BRK [0x114a02000, 0x114a02fff] PGTABLE +
-Jun 03 09:01:10 centos8.ittraining.loc kernel: BRK [0x114a03000, 0x114a03fff] PGTABLE +
-Jun 03 09:01:10 centos8.ittraining.loc kernel: BRK [0x114a04000, 0x114a04fff] PGTABLE +
-Jun 03 09:01:10 centos8.ittraining.loc kernel: BRK [0x114a05000, 0x114a05fff] PGTABLE +
-Jun 03 09:01:10 centos8.ittraining.loc kernel: BRK [0x114a06000, 0x114a06fff] PGTABLE +
-Jun 03 09:01:10 centos8.ittraining.loc kernel: BRK [0x114a07000, 0x114a07fff] PGTABLE +
-Jun 03 09:01:10 centos8.ittraining.loc kernel: BRK [0x114a08000, 0x114a08fff] PGTABLE +
-Jun 03 09:01:10 centos8.ittraining.loc kernel: BRK [0x114a09000, 0x114a09fff] PGTABLE +
-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   VBOXXSDT 00000001 ASL  00000061) +
-Jun 03 09:01:10 centos8.ittraining.loc kernel: ACPI: FACP 0x00000000DFFF00F0 0000F4 (v04 VBOX   VBOXFACP 00000001 ASL  00000061) +
-Jun 03 09:01:10 centos8.ittraining.loc kernel: ACPI: DSDT 0x00000000DFFF0480 002325 (v02 VBOX   VBOXBIOS 00000002 INTL 20190509) +
-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   VBOXAPIC 00000001 ASL  00000061) +
-lines 1-57 +
-</code>+
  
-<WRAP center round important 60%> +      --help     display this help and exit 
-**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. +      --version  output version information and exit
-</WRAP>+
  
-====5.2 - Consultation des Journaux d'une Application Spécifique====+If standard input is a terminal, redirect it from an unreadable file. 
 +If standard output is a terminal, append output to 'nohup.out' if possible, 
 +'$HOME/nohup.out' otherwise. 
 +If standard error is a terminal, redirect it to standard output. 
 +To save output to FILE, use 'nohup COMMAND > FILE'.
  
-Pour consulter les entrées concernant une application spécifiqueil suffit de passer l'exécutable, y compris son chemin complet, en argument à la commande journalctl : +NOTE: your shell may have its own version of nohupwhich usually supersedes 
 +the version described here.  Please refer to your shell's documentation 
 +for details about the options it supports.
  
-<code> +GNU coreutils online help: <https://www.gnu.org/software/coreutils/> 
-[root@centos8 ~]# journalctl /sbin/anacron +Full documentation <https://www.gnu.org/software/coreutils/nohup> 
--- Logs begin at Thu 2021-06-03 09:01:10 EDT, end at Thu 2021-06-03 13:10:01 EDT-- +or available locally viainfo '(coreutilsnohup invocation'
-Jun 03 10:01:01 centos8.ittraining.loc anacron[2575]: Anacron started on 2021-06-03 +
-Jun 03 10:01:01 centos8.ittraining.loc anacron[2575]: Will run job `cron.daily' in 15 min+
-Jun 03 10:01:01 centos8.ittraining.loc anacron[2575]: Jobs will be executed sequentially +
-Jun 03 10:16:01 centos8.ittraining.loc anacron[2575]: Job `cron.dailystarted +
-Jun 03 10:16:01 centos8.ittraining.loc anacron[2575]: Job `cron.daily' terminated +
-Jun 03 10:16:01 centos8.ittraining.loc anacron[2575]: Normal exit (1 job run)+
 </code> </code>
  
-<WRAP center round important 60%> +====1.10 La Commande kill====
-**Important** : Rappelez-vous que sous RHEL/CentOS 8 le répertoire **/sbin** est un lien symbolique vers **/usr/sbin**. +
-</WRAP> +
- +
-====5.Consultation des Journaux depuis le Dernier Démarrage====+
  
-Pour consulter les entrées depuis le dernier démarrage, il suffit d'utiliser l'option **-b** de la commande journalctl +La commande kill envoie des signaux aux processus. La liste des signaux possibles peut être afficher avec l'option **-l** :
  
 <code> <code>
-[root@centos8 ~]# journalctl -b | more +[root@redhat9 ~]# kill -l 
--- Logs begin at Thu 2021-06-03 09:01:10 EDT, end at Thu 2021-06-03 13:11:01 EDT. -- + 1) SIGHUP       2) SIGINT       3) SIGQUIT      4) SIGILL       5) SIGTRAP 
-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 + 6SIGABRT      7SIGBUS       8) SIGFPE       9) SIGKILL     10) SIGUSR1 
- 8.3.1 20191121 (Red Hat 8.3.1-5) (GCC)) #1 SMP Thu Apr 19:01:30 UTC 2021 +11) SIGSEGV     12) SIGUSR2     13) SIGPIPE     14) SIGALRM     15) SIGTERM 
-Jun 03 09:01:10 centos8.ittraining.loc kernel: Command line: BOOT_IMAGE=(hd0,msdos1)/vmlinuz-4.18.0-240.22.1.el8_3.x86_64 root=UUID=4c0cc28 +16) SIGSTKFLT   17) SIGCHLD     18) SIGCONT     19) SIGSTOP     20) SIGTSTP 
-c-0d59-45be-bd73-d292b80be33c ro crashkernel=auto resume=UUID=c8bb3f47-d67f-4b21-b781-766899dc83d4 rhgb quiet +21) SIGTTIN     22) SIGTTOU     23) SIGURG      24) SIGXCPU     25) SIGXFSZ 
-Jun 03 09:01:10 centos8.ittraining.loc kernel: x86/fpu: Supporting XSAVE feature 0x001: 'x87 floating point registers' +26) SIGVTALRM   27) SIGPROF     28) SIGWINCH    29) SIGIO       30) SIGPWR 
-Jun 03 09:01:10 centos8.ittraining.loc kernel: x86/fpu: Supporting XSAVE feature 0x002: 'SSE registers' +31) SIGSYS      34) SIGRTMIN    35) SIGRTMIN+1  36) SIGRTMIN+2  37) SIGRTMIN+3 
-Jun 03 09:01:10 centos8.ittraining.loc kernel: x86/fpu: Supporting XSAVE feature 0x004: 'AVX registers' +38) SIGRTMIN+4  39) SIGRTMIN+5  40) SIGRTMIN+6  41) SIGRTMIN+7  42) SIGRTMIN+8 
-Jun 03 09:01:10 centos8.ittraining.loc kernel: x86/fpu: xstate_offset[2]:  576, xstate_sizes[2]:  256 +43) SIGRTMIN+9  44) SIGRTMIN+10 45) SIGRTMIN+11 46) SIGRTMIN+12 47) SIGRTMIN+13 
-Jun 03 09:01:10 centos8.ittraining.loc kernel: x86/fpu: Enabled xstate features 0x7, context size is 832 bytes, using 'standard' format. +48) SIGRTMIN+14 49) SIGRTMIN+15 50) SIGRTMAX-14 51) SIGRTMAX-13 52) SIGRTMAX-12 
-Jun 03 09:01:10 centos8.ittraining.loc kernel: BIOS-provided physical RAM map: +53) SIGRTMAX-11 54) SIGRTMAX-10 55) SIGRTMAX-9  56) SIGRTMAX-8  57) SIGRTMAX-7 
-Jun 03 09:01:10 centos8.ittraining.loc kernel: BIOS-e820: [mem 0x0000000000000000-0x000000000009fbff] usable +58) SIGRTMAX-6  59) SIGRTMAX-5  60) SIGRTMAX-4  61) SIGRTMAX-3  62) SIGRTMAX-2 
-Jun 03 09:01:10 centos8.ittraining.loc kernel: BIOS-e820: [mem 0x000000000009fc00-0x000000000009ffff] reserved +63) SIGRTMAX-1  64SIGRTMAX
-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 Disableprotection: 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/VirtualBox, BIOS VirtualBox 12/01/2006 +
-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: kvm-clock: mask: 0xffffffffffffffff max_cycles: 0x1cd42e4dffb, max_idle_ns: 881 +
-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--+
 </code> </code>
  
-<WRAP center round important 60%+<WRAP center round important> 
-**Important** : Notez que vous pouvez consulter les messages des démarrages précédents, il est possible d'utiliser les options **-b 1****-b 2** etc.+**Important** - Vous constaterez que chaque signal possède un numéro. Ces numéros de signaux sont utilisés à la place des options. Par exemple, **-19** à la place de l'option **-stop**.
 </WRAP> </WRAP>
  
-====5.4 - Consultation des Journaux d'une Priorité Spécifique====+Parmi les numéros de signaux les plus utiles on trouve :
  
-Pour consulter les entrées à partir d'une priorité spécifique et supérieur, il suffit d'utiliser l'option **-p** de la commande journalctl en spécifiant la priorité concernée : +^ Numéro ^ Description ^ 
 +| -1 | Le signal Hang Up est envoyé à tous les enfants d'un processus quand il se termine | 
 +| -2 | Interruption du processus - équivalent à <key>C</key><key>c</key>
 +| -3 | La même chose que -2 mais avec la génération d'un fichier de déboggage | 
 +| -9 | Le signal qui tue un processus brutalement | 
 +| -15 | Le signal envoyé par défaut par la commande **kill**. Le processus se termine normalement |
  
-<code> +Les options de cette commande sont :
-[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:  #2 +
-Jun 03 09:01:10 centos8.ittraining.loc kernel:  #3 +
-Jun 03 09:01:10 centos8.ittraining.loc kernel: acpi PNP0A03:00: fail to add MMCONFIG information, can't access extended PCI configuration > +
-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:vmw_host_log [vmwgfx]] *ERROR* Failed to send host log message. +
-Jun 03 09:01:12 centos8.ittraining.loc kernel: [drm:vmw_host_log [vmwgfx]] *ERROR* Failed to send host log message. +
-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]: WARNING: AllowZoneDrifting is enabled. This is considered an insecure configuration> +
-Jun 03 09:01:21 centos8.ittraining.loc systemd[1]: iscsi.service: Unit cannot be reloaded because it is inactive. +
-Jun 03 09:01:24 centos8.ittraining.loc systemd[1]: iscsi.service: Unit cannot be reloaded because it is inactive. +
-Jun 03 09:01:24 centos8.ittraining.loc systemd[1]: iscsi.service: Unit cannot be reloaded because it is inactive. +
-Jun 03 09:01:26 centos8.ittraining.loc chronyd[850]: System clock wrong by 1.753498 seconds, adjustment started +
-Jun 03 09:01:28 centos8.ittraining.loc chronyd[850]: System clock was stepped by 1.753498 seconds +
-Jun 03 12:46:31 centos8.ittraining.loc chronyd[850]: System clock wrong by 47255.336542 seconds, adjustment started +
-lines 1-15/15 (END) +
-</code> +
- +
-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'Heures==== +
- +
-Pour consulter les entrées d'une plage de dates ou d'heures, il suffit de passer cette plage en argument à la commande journalctl +
  
 <code> <code>
-[root@centos8 ~]# journalctl --since 12:00 --until now +[root@redhat9 ~]# help kill 
--- Logs begin at Thu 2021-06-03 09:01:10 EDT, end at Thu 2021-06-03 13:14:01 EDT. -+killkill [-s sigspec | -n signum | -sigspecpid | jobspec ... or kill -[sigspec
-Jun 03 12:00:01 centos8.ittraining.loc systemd[1]: Started Session 181 of user trainee. +    Send a signal to a job
-Jun 03 12:00:01 centos8.ittraining.loc CROND[4238]: (trainee) CMD (/bin/pwd > pwd.txt) +     
-Jun 03 12:00:01 centos8.ittraining.loc systemd[1]: session-181.scope: Succeeded. +    Send the processes identified by PID or JOBSPEC the signal named by 
-Jun 03 12:01:01 centos8.ittraining.loc CROND[4251]: (root) CMD (run-parts /etc/cron.hourly) +    SIGSPEC or SIGNUM If neither SIGSPEC nor SIGNUM is present, then 
-Jun 03 12:01:01 centos8.ittraining.loc systemd[1]: Started Session 182 of user trainee+    SIGTERM is assumed
-Jun 03 12:01:01 centos8.ittraining.loc run-parts[4255]: (/etc/cron.hourly) starting 0anacron +     
-Jun 03 12:01:01 centos8.ittraining.loc CROND[4260]: (trainee) CMD (/bin/pwd > pwd.txt) +    Options
-Jun 03 12:01:01 centos8.ittraining.loc run-parts[4262]: (/etc/cron.hourly) finished 0anacron +      -s sig    SIG is a signal name 
-Jun 03 12:01:01 centos8.ittraining.loc systemd[1]: session-182.scope: Succeeded+      -n sig    SIG is a signal number 
-Jun 03 12:02:01 centos8.ittraining.loc systemd[1]: Started Session 183 of user trainee. +      -l        list the signal names; if arguments follow `-l' they are 
-Jun 03 12:02:01 centos8.ittraining.loc CROND[4275]: (trainee) CMD (/bin/pwd > pwd.txt) +                assumed to be signal numbers for which names should be listed 
-Jun 03 12:02:01 centos8.ittraining.loc systemd[1]: session-183.scope: Succeeded. +      -L        synonym for -l 
-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]: (trainee) CMD (/bin/pwd > pwd.txt) +    Kill is a shell builtin for two reasonsit allows job IDs to be used 
-Jun 03 12:03:01 centos8.ittraining.loc systemd[1]: session-184.scope: Succeeded. +    instead of process IDs, and allows processes to be killed if the limit 
-Jun 03 12:04:01 centos8.ittraining.loc systemd[1]: Started Session 185 of user trainee. +    on processes that you can create is reached
-Jun 03 12:04:01 centos8.ittraining.loc CROND[4303]: (trainee) CMD (/bin/pwd > pwd.txt) +     
-Jun 03 12:04:01 centos8.ittraining.loc systemd[1]: session-185.scope: Succeeded. +    Exit Status
-Jun 03 12:05:01 centos8.ittraining.loc systemd[1]: Started Session 186 of user trainee. +    Returns success unless an invalid option is given or an error occurs.
-Jun 03 12:05:01 centos8.ittraining.loc CROND[4319]: (trainee) CMD (/bin/pwd > pwd.txt) +
-Jun 03 12:05:01 centos8.ittraining.loc systemd[1]: session-186.scope: Succeeded. +
-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]: (trainee) CMD (/bin/pwd > pwd.txt) +
-Jun 03 12:06:02 centos8.ittraining.loc systemd[1]: session-187.scope: Succeeded. +
-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]: (trainee) CMD (/bin/pwd > pwd.txt) +
-Jun 03 12:07:01 centos8.ittraining.loc systemd[1]: session-188.scope: Succeeded. +
-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]: (trainee) CMD (/bin/pwd > pwd.txt) +
-Jun 03 12:08:01 centos8.ittraining.loc systemd[1]: session-189.scope: Succeeded. +
-lines 1-31+
 </code> </code>
  
-<WRAP center round important 60%> +====1.11 - La Commande pkill====
-**Important** : Il est possible d'utiliser des mots clefs : **yesterday**, **today**, **tomorrow**, **now**. +
-</WRAP>+
  
-====5.6 - Consultation des Journaux en Live==== +La commande pkill permet d'envoyer des signaux aux processus identifiés par leur nom. Par exemple la commande suivante force syslog de relire son fichier de configuration :
- +
-Pour consulter les journaux en live, il suffit d'utiliser l'option **-f** de la commande journalctl +
  
 <code> <code>
-[root@centos8 ~]# journalctl -+[root@redhat9 ~]# pkill -HUP rsyslogd
--- 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]: (trainee) CMD (/bin/pwd > pwd.txt) +
-Jun 03 13:14:01 centos8.ittraining.loc systemd[1]: session-256.scope: Succeeded. +
-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]: (trainee) CMD (/bin/pwd > pwd.txt) +
-Jun 03 13:15:01 centos8.ittraining.loc systemd[1]: session-257.scope: Succeeded. +
-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]: (trainee) CMD (/bin/pwd > pwd.txt) +
-Jun 03 13:16:02 centos8.ittraining.loc systemd[1]: session-258.scope: Succeeded. +
-^C+
 </code> </code>
  
-Ouvrez un deuxième terminal et saisissez la commande suivante :+Les options de cette commande sont :
  
 <code> <code>
-[trainee@centos8 ~]$ logger -p user.info Linux est super +[root@redhat9 ~]# pkill --help
-</code>+
  
-Retournez consulter le premier terminal :+Usage: 
 + pkill [options] <pattern>
  
-<code+Options: 
-[root@centos8 ~]# journalctl -f + -<sig>, --signal <sig>    signal to send (either number or name) 
--- Logs begin at Thu 2021-06-03 09:01:10 EDT. -- + -q, --queue <value>       integer value to be sent with the signal 
-Jun 03 13:13:08 centos8.ittraining.loc systemd[1]: Started dnf makecache+ -e, --echo                display what is killed 
-Jun 03 13:14:01 centos8.ittraining.loc systemd[1]: Started Session 256 of user trainee. + -c, --count               count of matching processes 
-Jun 03 13:14:01 centos8.ittraining.loc CROND[5391]: (trainee) CMD (/bin/pwd pwd.txt) + -f, --full                use full process name to match 
-Jun 03 13:14:01 centos8.ittraining.loc systemd[1]: session-256.scope: Succeeded. + -g, --pgroup <PGID,...>   match listed process group IDs 
-Jun 03 13:15:01 centos8.ittraining.loc systemd[1]: Started Session 257 of user trainee. + -G, --group <GID,...>     match real group IDs 
-Jun 03 13:15:01 centos8.ittraining.loc CROND[5407]: (trainee) CMD (/bin/pwd pwd.txt) + -i, --ignore-case         match case insensitively 
-Jun 03 13:15:01 centos8.ittraining.loc systemd[1]: session-257.scope: Succeeded. + -n, --newest              select most recently started 
-Jun 03 13:16:02 centos8.ittraining.loc systemd[1]: Started Session 258 of user trainee. + -o, --oldest              select least recently started 
-Jun 03 13:16:02 centos8.ittraining.loc CROND[5420]: (trainee) CMD (/bin/pwd pwd.txt) + -O, --older <seconds    select where older than seconds 
-Jun 03 13:16:02 centos8.ittraining.loc systemd[1]: session-258.scope: Succeeded+ -P, --parent <PPID,...>   match only child processes of the given parent 
-Jun 03 13:17:01 centos8.ittraining.loc systemd[1]: Started Session 259 of user trainee+ -s, --session <SID,...>   match session IDs 
-Jun 03 13:17:01 centos8.ittraining.loc CROND[5436]: (trainee) CMD (/bin/pwd pwd.txt) + -t, --terminal <tty,...>  match by controlling terminal 
-Jun 03 13:17:01 centos8.ittraining.loc systemd[1]: session-259.scope: Succeeded. + -u, --euid <ID,...>       match by effective IDs 
-Jun 03 13:17:19 centos8.ittraining.loc sshd[5439]: Accepted password for trainee from 10.0.2.2 port 39906 ssh2 + -U, --uid <ID,...>        match by real IDs 
-Jun 03 13:17:19 centos8.ittraining.loc systemd-logind[880]: New session 260 of user trainee. + -x, --exact               match exactly with the command name 
-Jun 03 13:17:19 centos8.ittraining.loc systemd[1]: Started Session 260 of user trainee. + -F, --pidfile <file>      read PIDs from file 
-Jun 03 13:17:19 centos8.ittraining.loc sshd[5439]: pam_unix(sshd:session): session opened for user trainee by (uid=0) + -L, --logpidfile          fail if PID file is not locked 
-Jun 03 13:17:34 centos8.ittraining.loc trainee[5470]: Linux est super + -r, --runstates <state>   match runstates [D,S,Z,...] 
-Jun 03 13:17:34 centos8.ittraining.loc rsyslogd[1113]: imjournal: journal files changedreloading...  [v8.1911.0-6.el8 try https://www.rsyslog.com/e/0 ] + --ns <PID>                match the processes that belong to the same 
-Jun 03 13:18:01 centos8.ittraining.loc systemd[1]: Started Session 261 of user trainee. +                           namespace as <pid> 
-Jun 03 13:18:01 centos8.ittraining.loc CROND[5481]: (trainee) CMD (/bin/pwd > pwd.txt) + --nslist <ns,...>         list which namespaces will be considered for 
-Jun 03 13:18:01 centos8.ittraining.loc systemd[1]: session-261.scope: Succeeded. +                           the --ns option
-^C +                           Available namespacesipc, mnt, net, pid, user, uts
-</code>+
  
-<WRAP center round important 60%> + -h, --help     display this help and exit 
-**Important** : Notez la présence de la ligne **Jun 03 13:17:34 centos8.ittraining.loc trainee[5470]: Linux est super**.  + -V, --version  output version information and exit
-</WRAP>+
  
-====5.7 - Consultation des Journaux avec des Mots Clefs=== +For more details see pgrep(1).
- +
-Pour consulter les mots clefs compris par Journald, tapez la commande **journalctl** puis appuyer **deux** fois sur la touche <key>Tab</key>+
- +
-<code> +
-[root@centos8 ~]# journalctl [tab] [tab] +
-_AUDIT_LOGINUID=              _HOSTNAME=                    NM_DEVICE=                    _SYSTEMD_SESSION= +
-_AUDIT_SESSION=               INITRD_USEC=                  NM_LOG_DOMAINS=               _SYSTEMD_SLICE= +
-AVAILABLE=                    INVOCATION_ID=                NM_LOG_LEVEL=                 _SYSTEMD_UNIT= +
-AVAILABLE_PRETTY=             JOB_ID=                       N_RESTARTS=                   _SYSTEMD_USER_SLICE= +
-_BOOT_ID=                     JOB_RESULT=                   _PID=                         _SYSTEMD_USER_UNIT= +
-_CAP_EFFECTIVE=               JOB_TYPE=                     PRIORITY=                     TIMESTAMP_BOOTTIME= +
-_CMDLINE=                     JOURNAL_NAME=                 SEAT_ID=                      TIMESTAMP_MONOTONIC= +
-CODE_FILE=                    JOURNAL_PATH=                 _SELINUX_CONTEXT=             _TRANSPORT= +
-CODE_FUNC=                    _KERNEL_DEVICE=               SESSION_ID=                   _UDEV_DEVNODE= +
-CODE_LINE=                    _KERNEL_SUBSYSTEM=            _SOURCE_MONOTONIC_TIMESTAMP=  _UDEV_SYSNAME= +
-_COMM=                        KERNEL_USEC=                  _SOURCE_REALTIME_TIMESTAMP=   _UID= +
-CURRENT_USE=                  LEADER=                       SSSD_DOMAIN=                  UNIT= +
-CURRENT_USE_PRETTY=           LIMIT=                        _STREAM_ID=                   USER_ID= +
-DISK_AVAILABLE=               LIMIT_PRETTY=                 SYSLOG_FACILITY=              USER_INVOCATION_ID= +
-DISK_AVAILABLE_PRETTY=        _MACHINE_ID=                  SYSLOG_IDENTIFIER=            USERSPACE_USEC= +
-DISK_KEEP_FREE=               MAX_USE=                      SYSLOG_PID=                   USER_UNIT= +
-DISK_KEEP_FREE_PRETTY=        MAX_USE_PRETTY=               _SYSTEMD_CGROUP=               +
-_EXE=                         MESSAGE=                      _SYSTEMD_INVOCATION_ID=        +
-_GID=                         MESSAGE_ID=                   _SYSTEMD_OWNER_UID=    +
-</code> +
- +
-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 <key>Tab</key>+
- +
-<code> +
-[root@centos8 ~]# journalctl _UID= +
-0     1000  81    983   990   992   998    +
-[root@centos8 ~]# journalctl _COMM= +
-anacron          dbus-daemon      kdumpctl         NetworkManager   smartd           sssd_nss         systemd-hiberna   +
-auditd           dnf              logger           polkitd          sm-notify        su               systemd-journal   +
-augenrules       dnsmasq          login            rngd             sshd             (systemd       systemd-logind    +
-chronyd          dracut-cmdline   lvm              rsyslogd         sssd             systemd          systemd-udevd     +
-crond            firewalld        netcf-transacti  sh               sssd_be          systemd-fsck   +
 </code> </code>
  
 ----- -----
 Copyright © 2024 Hugh Norris. Copyright © 2024 Hugh Norris.
Menu