rocky linux의 경우 기본적으로 설치시 dmesg의 log 파일이 생성되지 않는다
/var/log/dmesg (부팅 기록)
부팅시 로그 파일이 생성될 수 있게 구성한다
1 2 3 4 5 6 7 8 9 10 11 12 13 |
[root@ ~]# vi /etc/systemd/system/dmesg.service [Unit] Description=Create /var/log/dmesg on boot ConditionPathExists=/var/log/dmesg [Service] ExecStart=/usr/bin/dmesg StandardOutput=file:/var/log/dmesg [Install] WantedBy=multi-user.target |
touch 명령어로 파일 생성
1 |
[root@han ~]# touch /var/log/dmesg |
부팅시 활성화
1 2 |
[root@han ~]# systemctl enable dmesg.service Created symlink /etc/systemd/system/multi-user.target.wants/dmesg.service → /etc/systemd/system/dmesg.service. |
서비스 시작 및 확인
1 2 3 4 5 6 7 8 9 10 |
[root@ ~]# systemctl start dmesg.service [root@ ~]# systemctl status dmesg.service ● dmesg.service - Create /var/log/dmesg on boot Loaded: loaded (/etc/systemd/system/dmesg.service; enabled; vendor preset: disabled) Active: inactive (dead) since Wed 2023-10-04 17:53:04 KST; 2s ago Process: 272518 ExecStart=/usr/bin/dmesg (code=exited, status=0/SUCCESS) Main PID: 272518 (code=exited, status=0/SUCCESS) 10월 04 17:53:04 localhost systemd[1]: Started Create /var/log/dmesg on boot. 10월 04 17:53:04 localhost systemd[1]: dmesg.service: Succeeded. |
파일 확인
1 2 |
[root@ ~]# ls -l /var/log/dmesg -rw-r--r-- 1 root root 66256 10월 4 17:53 /var/log/dmesg |
내용도 확인
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
[root@han ~]# cat /var/log/dmesg | more [ 0.000000] microcode: microcode updated early to revision 0x621, date = 2020-03-04 [ 0.000000] Linux version 4.18.0-477.10.1.el8_8.x86_64 (mockbuild@iad1-prod-build001.bld.equ.rockylinux.org) (gcc version 8.5.0 20210 514 (Red Hat 8.5.0-18) (GCC)) #1 SMP Tue May 16 11:38:37 UTC 2023 [ 0.000000] Command line: BOOT_IMAGE=(hd0,msdos1)/vmlinuz-4.18.0-477.10.1.el8_8.x86_64 root=UUID=af36f271-caf9-45d6-8208-ca41f04e6ba1 ro crashkernel=auto resume=UUID=c316b393-4db8-4a42-a22e-4c68299cee07 [ 0.000000] x86/fpu: Supporting XSAVE feature 0x001: 'x87 floating point registers' [ 0.000000] x86/fpu: Supporting XSAVE feature 0x002: 'SSE registers' [ 0.000000] x86/fpu: Supporting XSAVE feature 0x004: 'AVX registers' [ 0.000000] x86/fpu: xstate_offset[2]: 576, xstate_sizes[2]: 256 [ 0.000000] x86/fpu: Enabled xstate features 0x7, context size is 832 bytes, using 'standard' format. [ 0.000000] signal: max sigframe size: 1776 [ 0.000000] BIOS-provided physical RAM map: [ 0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009abff] usable [ 0.000000] BIOS-e820: [mem 0x000000000009ac00-0x000000000009ffff] reserved [ 0.000000] BIOS-e820: [mem 0x00000000000e0000-0x00000000000fffff] reserved [ 0.000000] BIOS-e820: [mem 0x0000000000100000-0x000000007dcf5fff] usable [ 0.000000] BIOS-e820: [mem 0x000000007dcf6000-0x000000007dd84fff] reserved [ 0.000000] BIOS-e820: [mem 0x000000007dd85000-0x000000007de8dfff] ACPI data [ 0.000000] BIOS-e820: [mem 0x000000007de8e000-0x000000007e0befff] ACPI NVS [ 0.000000] BIOS-e820: [mem 0x000000007e0bf000-0x000000007f360fff] reserved [ 0.000000] BIOS-e820: [mem 0x000000007f361000-0x000000007f7fffff] ACPI NVS [ 0.000000] BIOS-e820: [mem 0x0000000080000000-0x000000008fffffff] reserved [ 0.000000] BIOS-e820: [mem 0x00000000fed1c000-0x00000000fed3ffff] reserved [ 0.000000] BIOS-e820: [mem 0x00000000ff000000-0x00000000ffffffff] reserved [ 0.000000] BIOS-e820: [mem 0x0000000100000000-0x000000047fffffff] usable [ 0.000000] NX (Execute Disable) protection: active [ 0.000000] SMBIOS 2.7 present. [ 0.000000] DMI: Supermicro X9DRD-iF/LF/X9DRD-iF, BIOS 3.0b 12/05/2013 |
rogrotate 등록 / dmesg 추가만 진행
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
[root@ ~]# vi /etc/logrotate.d/syslog /var/log/cron /var/log/maillog /var/log/messages /var/log/secure /var/log/spooler /var/log/dmesg { missingok sharedscripts postrotate /usr/bin/systemctl -s HUP kill rsyslog.service >/dev/null 2>&1 || true endscript } |