Commandes Linux : dmesg

DMESG

Installé avec le paquet util-linux

 

Afficher la version de la commande dmesg

dmesg --version

ou

apt-cache policy util-linux

 

Afficher le tampon circulaire du noyau

dmesg

ex :

dmesg
[...]
[   14.893987] bridge: filtering via arp/ip/ip6tables is no longer available by default. Update your scripts to load br_netfilter if you need this.
[   14.929783] Bridge firewalling registered
[   14.953531] nf_conntrack version 0.5.0 (16384 buckets, 65536 max)
[   15.621263] Initializing XFRM netlink socket
[   15.703066] Netfilter messages via NETLINK v0.30.
[   15.707506] ctnetlink v0.93: registering with nfnetlink.
[   15.879272] IPv6: ADDRCONF(NETDEV_UP): br-33027d9ea5d2: link is not ready
[   16.147636] IPv6: ADDRCONF(NETDEV_UP): docker0: link is not ready
[   56.446737] fuse init (API version 7.26)

 

Afficher l’horodatage et la différence de temps passé entre les messages

Avec l’horodatage :

dmesg -d

ou

dmesg --show-delta

Sans l’horodatage :

dmesg -d -t

ou

dmesg --show-delta --notime

ou

dmesg --time-format delta

ex :

# dmesg -d
[...]
[   14.893987 <    0,732684>] bridge: filtering via arp/ip/ip6tables is no longer available by default. Update your scripts to load br_netfilter if you need this.
[   14.929783 <    0,035796>] Bridge firewalling registered
[   14.953531 <    0,023748>] nf_conntrack version 0.5.0 (16384 buckets, 65536 max)
[   15.621263 <    0,667732>] Initializing XFRM netlink socket
[   15.703066 <    0,081803>] Netfilter messages via NETLINK v0.30.
[   15.707506 <    0,004440>] ctnetlink v0.93: registering with nfnetlink.
[   15.879272 <    0,171766>] IPv6: ADDRCONF(NETDEV_UP): br-33027d9ea5d2: link is not ready
[   16.147636 <    0,268364>] IPv6: ADDRCONF(NETDEV_UP): docker0: link is not ready
[   56.446737 <   40,299101>] fuse init (API version 7.26)
# dmesg -dt
[<    0,732684>] bridge: filtering via arp/ip/ip6tables is no longer available by default. Update your scripts to load br_netfilter if you need this.
[<    0,035796>] Bridge firewalling registered
[<    0,023748>] nf_conntrack version 0.5.0 (16384 buckets, 65536 max)
[<    0,667732>] Initializing XFRM netlink socket
[<    0,081803>] Netfilter messages via NETLINK v0.30.
[<    0,004440>] ctnetlink v0.93: registering with nfnetlink.
[<    0,171766>] IPv6: ADDRCONF(NETDEV_UP): br-33027d9ea5d2: link is not ready
[<    0,268364>] IPv6: ADDRCONF(NETDEV_UP): docker0: link is not ready
[<   40,299101>] fuse init (API version 7.26)

 

Afficher la date locale et la différence en format lisible

dmesg -e

ou

dmesg --reltime

ou

dmesg --time-format reltime

ou

dmesg -H --nopager

ex :

# dmesg -e
[...]
[  +0,732684] bridge: filtering via arp/ip/ip6tables is no longer available by default. Update your scripts to load br_netfilter if you need this.
[  +0,035796] Bridge firewalling registered
[  +0,023748] nf_conntrack version 0.5.0 (16384 buckets, 65536 max)
[  +0,667732] Initializing XFRM netlink socket
[  +0,081803] Netfilter messages via NETLINK v0.30.
[  +0,004440] ctnetlink v0.93: registering with nfnetlink.
[  +0,171766] IPv6: ADDRCONF(NETDEV_UP): br-33027d9ea5d2: link is not ready
[  +0,268364] IPv6: ADDRCONF(NETDEV_UP): docker0: link is not ready
[juil.30 12:08] fuse init (API version 7.26)

 

Afficher l’horodatage au format lisible

dmesg -T

ou

dmesg --ctime

ou

dmesg --time-format ctime

ex :

# dmesg -T
[...]
[lun. juil. 30 12:07:45 2018] bridge: filtering via arp/ip/ip6tables is no longer available by default. Update your scripts to load br_netfilter if you need this.
[lun. juil. 30 12:07:45 2018] Bridge firewalling registered
[lun. juil. 30 12:07:45 2018] nf_conntrack version 0.5.0 (16384 buckets, 65536 max)
[lun. juil. 30 12:07:46 2018] Initializing XFRM netlink socket
[lun. juil. 30 12:07:46 2018] Netfilter messages via NETLINK v0.30.
[lun. juil. 30 12:07:46 2018] ctnetlink v0.93: registering with nfnetlink.
[lun. juil. 30 12:07:46 2018] IPv6: ADDRCONF(NETDEV_UP): br-33027d9ea5d2: link is not ready
[lun. juil. 30 12:07:47 2018] IPv6: ADDRCONF(NETDEV_UP): docker0: link is not ready
[lun. juil. 30 12:08:27 2018] fuse init (API version 7.26)
# dmesg -dT
[...]
[lun. juil. 30 12:07:45 2018 <    0,732684>] bridge: filtering via arp/ip/ip6tables is no longer available by default. Update your scripts to load br_netfilter if you need this.
[lun. juil. 30 12:07:45 2018 <    0,035796>] Bridge firewalling registered
[lun. juil. 30 12:07:45 2018 <    0,023748>] nf_conntrack version 0.5.0 (16384 buckets, 65536 max)
[lun. juil. 30 12:07:46 2018 <    0,667732>] Initializing XFRM netlink socket
[lun. juil. 30 12:07:46 2018 <    0,081803>] Netfilter messages via NETLINK v0.30.
[lun. juil. 30 12:07:46 2018 <    0,004440>] ctnetlink v0.93: registering with nfnetlink.
[lun. juil. 30 12:07:46 2018 <    0,171766>] IPv6: ADDRCONF(NETDEV_UP): br-33027d9ea5d2: link is not ready
[lun. juil. 30 12:07:47 2018 <    0,268364>] IPv6: ADDRCONF(NETDEV_UP): docker0: link is not ready
[lun. juil. 30 12:08:27 2018 <   40,299101>] fuse init (API version 7.26)

 

Afficher les horodatages en utilisant le format indiqué

Afficher l’horodatage au format lisible :

dmesg --time-format ctime

Afficher la date locale et la différence en format lisible :

dmesg --time-format reltime

Afficher l’horodatage et la différence de temps passé entre les messages

dmesg --time-format delta

Afficher l’horodatage au format AAAA-MM-JJHH:MM:SS :

dmesg --time-format iso

ex :

# dmesg --time-format ctime
[...]
[lun. juil. 30 12:07:45 2018] bridge: filtering via arp/ip/ip6tables is no longer available by default. Update your scripts to load br_netfilter if you need this.
[lun. juil. 30 12:07:45 2018] Bridge firewalling registered
[lun. juil. 30 12:07:45 2018] nf_conntrack version 0.5.0 (16384 buckets, 65536 max)
[lun. juil. 30 12:07:46 2018] Initializing XFRM netlink socket
[lun. juil. 30 12:07:46 2018] Netfilter messages via NETLINK v0.30.
[lun. juil. 30 12:07:46 2018] ctnetlink v0.93: registering with nfnetlink.
[lun. juil. 30 12:07:46 2018] IPv6: ADDRCONF(NETDEV_UP): br-33027d9ea5d2: link is not ready
[lun. juil. 30 12:07:47 2018] IPv6: ADDRCONF(NETDEV_UP): docker0: link is not ready
[lun. juil. 30 12:08:27 2018] fuse init (API version 7.26)
# dmesg --time-format reltime
[...]
[  +0,732684] bridge: filtering via arp/ip/ip6tables is no longer available by default. Update your scripts to load br_netfilter if you need this.
[  +0,035796] Bridge firewalling registered
[  +0,023748] nf_conntrack version 0.5.0 (16384 buckets, 65536 max)
[  +0,667732] Initializing XFRM netlink socket
[  +0,081803] Netfilter messages via NETLINK v0.30.
[  +0,004440] ctnetlink v0.93: registering with nfnetlink.
[  +0,171766] IPv6: ADDRCONF(NETDEV_UP): br-33027d9ea5d2: link is not ready
[  +0,268364] IPv6: ADDRCONF(NETDEV_UP): docker0: link is not ready
[juil.30 12:08] fuse init (API version 7.26)
# dmesg --time-format delta
[...]
[   14.893987 <    0,732684>] bridge: filtering via arp/ip/ip6tables is no longer available by default. Update your scripts to load br_netfilter if you need this.
[   14.929783 <    0,035796>] Bridge firewalling registered
[   14.953531 <    0,023748>] nf_conntrack version 0.5.0 (16384 buckets, 65536 max)
[   15.621263 <    0,667732>] Initializing XFRM netlink socket
[   15.703066 <    0,081803>] Netfilter messages via NETLINK v0.30.
[   15.707506 <    0,004440>] ctnetlink v0.93: registering with nfnetlink.
[   15.879272 <    0,171766>] IPv6: ADDRCONF(NETDEV_UP): br-33027d9ea5d2: link is not ready
[   16.147636 <    0,268364>] IPv6: ADDRCONF(NETDEV_UP): docker0: link is not ready
[   56.446737 <   40,299101>] fuse init (API version 7.26)
# dmesg --time-format iso
[...]
2018-07-30T12:07:45,893987+0200 bridge: filtering via arp/ip/ip6tables is no longer available by default. Update your scripts to load br_netfilter if you need this.
2018-07-30T12:07:45,929783+0200 Bridge firewalling registered
2018-07-30T12:07:45,953531+0200 nf_conntrack version 0.5.0 (16384 buckets, 65536 max)
2018-07-30T12:07:46,621263+0200 Initializing XFRM netlink socket
2018-07-30T12:07:46,703066+0200 Netfilter messages via NETLINK v0.30.
2018-07-30T12:07:46,707506+0200 ctnetlink v0.93: registering with nfnetlink.
2018-07-30T12:07:46,879272+0200 IPv6: ADDRCONF(NETDEV_UP): br-33027d9ea5d2: link is not ready
2018-07-30T12:07:47,147636+0200 IPv6: ADDRCONF(NETDEV_UP): docker0: link is not ready
2018-07-30T12:08:27,446737+0200 fuse init (API version 7.26)

 

Décoder les numéros de service et de niveau (priorité) en préfixes lisibles

dmesg -x

ou

dmesg --decode

ex :

# dmesg -x
kern  :info  : [   14.893987] bridge: filtering via arp/ip/ip6tables is no longer available by default. Update your scripts to load br_netfilter if you need this.
kern  :notice: [   14.929783] Bridge firewalling registered
kern  :info  : [   14.953531] nf_conntrack version 0.5.0 (16384 buckets, 65536 max)
kern  :info  : [   15.621263] Initializing XFRM netlink socket
kern  :info  : [   15.703066] Netfilter messages via NETLINK v0.30.
kern  :info  : [   15.707506] ctnetlink v0.93: registering with nfnetlink.
kern  :info  : [   15.879272] IPv6: ADDRCONF(NETDEV_UP): br-33027d9ea5d2: link is not ready
kern  :info  : [   16.147636] IPv6: ADDRCONF(NETDEV_UP): docker0: link is not ready
kern  :info  : [   56.446737] fuse init (API version 7.26)

 

Restreindre l’affichage à la liste de services (séparés par des virgules) indiquée

dmesg -f services

ou

dmesg --facility services

Les services spécifiés sont séparés par des virgules :

  • kern – messages du noyau
  • user – messages utilisateur aléatoires
  • mail – système de courrier électronique
  • daemon – démons du système
  • auth – message de sécurité ou autorisation
  • syslog – message interne de syslogd
  • lpr – message du sous-système d’impression
  • news – sous-système de nouvelles réseau

Rmq :
dmesg -f kern équivaut à dmesg -k
ex :

# dmesg -x -f daemon,syslog
daemon:info  : [    5.391005] systemd[1]: Detected virtualization oracle.
daemon:info  : [    5.391009] systemd[1]: Detected architecture x86-64.
daemon:info  : [    5.391957] systemd[1]: Set hostname to .
daemon:info  : [    5.727866] systemd[1]: Set up automount Arbitrary Executable File Formats File System Automount Point.
daemon:info  : [    5.727946] systemd[1]: Listening on Journal Audit Socket.
daemon:info  : [    5.727972] systemd[1]: Listening on /dev/initctl Compatibility Named Pipe.
daemon:info  : [    5.727991] systemd[1]: Listening on fsck to fsckd communication Socket.
daemon:info  : [    5.727998] systemd[1]: Reached target Remote File Systems.
daemon:info  : [    5.728145] systemd[1]: Started Forward Password Requests to Wall Directory Watch.
syslog:info  : [    6.250103] systemd-journald[183]: Received request to flush runtime journal from PID 1

 

Restreindre l’affichage à la liste de niveaux (séparés par des virgules) indiquée

dmesg -l levels

ou

dmesg --level levels

Les services spécifiés sont séparés par des virgules :

  • emerg – le système est inutilisable
  • alert – il faut agir immédiatement
  • crit – conditions critiques
  • err – conditions d’erreur
  • warn – conditions d’avertissement
  • notice – condition normale mais significative
  • info – information
  • debug – messages du niveau de débogage

ex :

# dmesg -x -l warn,notice
kern  :notice: [    4.689236] random: fast init done
kern  :notice: [    6.824719] sr 1:0:0:0: Attached scsi generic sg0 type 5
kern  :notice: [    6.828866] sd 2:0:0:0: Attached scsi generic sg1 type 0
kern  :warn  : [    7.095216] vboxvideo: loading out-of-tree module taints kernel.
kern  :notice: [    7.429817] random: crng init done
kern  :warn  : [    9.615420] vgdrvHeartbeatInit: Setting up heartbeat to trigger every 2000 milliseconds
kern  :warn  : [    9.622173] vboxguest: misc device minor 58, IRQ 20, I/O port d020, MMIO at 00000000f0400000 (size 0x400000)

 

Attendre de nouveaux messages

dmesg -w

ou

dmesg --follow
Fermer le menu
%d blogueurs aiment cette page :