如何修改dmesg log buffer size

本文详细介绍了Linux内核中CONFIG_LOG_BUF_SHIFT配置项的作用与设置方法,该配置项决定了内核日志缓冲区的大小,对于不同架构与场景提供了推荐的默认值。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

CONFIG_LOG_BUF_SHIFT: Kernel log buffer size (16 => 64KB, 17 => 128KB)

General informations

The Linux kernel configuration item CONFIG_LOG_BUF_SHIFT has multiple definitions:

found in arch/sh64/Kconfig

The configuration item CONFIG_LOG_BUF_SHIFT:

  • prompt:
  • type: int
  • depends on: (none)
  • defined in arch/sh64/Kconfig
  • found in Linux kernels: 2.6.8–2.6.13

Help text

(none)

Kernel log buffer size (16 => 64KB, 17 => 128KB) found in init/Kconfig

The configuration item CONFIG_LOG_BUF_SHIFT:

  • prompt: Kernel log buffer size (16 => 64KB, 17 => 128KB)
  • type: int
  • depends on: (none)
  • defined in init/Kconfig
  • found in Linux kernels: 2.6.0–2.6.11, 2.6.22–2.6.39, 3.0–3.13, 3.14-rc+HEAD

Help text

Select kernel log buffer size as a power of 2. Examples: 17 => 128 KB 16 => 64 KB 15 => 32 KB 14 => 16 KB 13 => 8 KB 12 => 4 KB

Kernel log buffer size (16 => 64KB, 17 => 128KB) found in lib/Kconfig.debug

The configuration item CONFIG_LOG_BUF_SHIFT:

Help text

Select kernel log buffer size as a power of 2. Defaults and Examples: 17 => 128 KB for S/390 16 => 64 KB for x86 NUMAQ or IA-64 15 => 32 KB for SMP 14 => 16 KB for uniprocessor 13 => 8 KB 12 => 4 KB

Hardware

LKDDb

Raw data from LKDDb:

  • (none)

Sources

This page is automaticly generated with free (libre, open) software lkddb(see lkddb-sources).

The data is retrived from:



How is emlog used? 1: Configure, compile, and install emlog If you want to compile emlog for use with the currently running kernel, simply run make Otherwise, you have to set either KVER (for linux kernel sources, located in /lib/modules/<KVER>/build) or KDIR (for any other path): make KDIR=/usr/src/linux Two files should be generated: the kernel module itself (emlog.ko), and the nbcat utility that will be described later. You can use them directly from the current directory or you can install them via make install 2: Load the emlog module into the kernel If you chose to use emlog directly from the current directly, insert the module into the kernel using the insmod command insmod emlog.ko Otherwise, modprobe should work: modprobe emlog To specify a different maximum buffer size limit: modprobe emlog emlog_max_size=2048 If successful, a message similar to emlog:emlog_init: version 0.70 running, major is 251, MINOR is 1, max size 1024 K. should show up in your kernel log (type dmesg to see it). You can also verify that the module has been inserted by typing lsmod or cat /proc/modules. 3: Create device files for emlog By default, a device file /dev/emlog is created (if you have devtmpfs mounted onto /dev and/or have udev running) with a minimal allocated buffer. It's ready to be written to/read from. If you need more devices/buffers, you should can use the mkemlog program to create device files that your processes can write to. Usage mkemlog <logdevname> [size_in_kilobytes] [mode] 3.1: Examples usage mkemlog Create a log file with a 8k buffer with file permissions 0660 mkemlog /tmp/testlog Create a log file with a 17k buffer with file permissions 0660 mkemlog /tmp/testlog 17 Create a log file with a 12k buffer with file permissions 0644 mkemlog /tmp/testlog_12k 12 0644 Create a log file with a 18k buffer with file permissions 0644, owned by a user with UID==1000. mkemlog /tmp/testlog_18k 18 0644 1000 The mkemlog requires the /dev/emlog file to be cemlog
04-02
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

YoungerChina

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值