<!DOCTYPE html>
<html lang="en" data-content_root="../">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Netconsole — The Linux Kernel documentation</title>
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=fa44fd50" />
<link rel="stylesheet" type="text/css" href="../_static/alabaster.css?v=3918102e" />
<script src="../_static/documentation_options.js?v=5929fcd5"></script>
<script src="../_static/doctools.js?v=9bcbadda"></script>
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="Netdev features mess and how to get out from it alive" href="netdev-features.html" />
<link rel="prev" title="tcp_sock struct fast path usage breakdown" href="net_cachelines/tcp_sock.html" />
<link rel="stylesheet" href="../_static/custom.css" type="text/css" />
</head><body>
<div class="document">
<div class="sphinxsidebar" role="navigation" aria-label="Main">
<div class="sphinxsidebarwrapper">
<p class="logo"><a href="../index.html">
<img class="logo" src="../_static/logo.svg" alt="Logo of The Linux Kernel"/>
</a></p>
<h1 class="logo"><a href="../index.html">The Linux Kernel</a></h1>
<p class="blurb">6.18.50</p>
<search id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="../search.html" method="get">
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
<input type="submit" value="Go" />
</form>
</div>
</search>
<script>document.getElementById('searchbox').style.display = "block"</script>
<p>
<h3 class="kernel-toc-contents">Contents</h3>
<input type="checkbox" class="kernel-toc-toggle" id = "kernel-toc-toggle" checked>
<label class="kernel-toc-title" for="kernel-toc-toggle"></label>
<div class="kerneltoc" id="kerneltoc">
<ul>
<li class="toctree-l1"><a class="reference internal" href="../process/development-process.html">Development process</a></li>
<li class="toctree-l1"><a class="reference internal" href="../process/submitting-patches.html">Submitting patches</a></li>
<li class="toctree-l1"><a class="reference internal" href="../process/code-of-conduct.html">Code of conduct</a></li>
<li class="toctree-l1"><a class="reference internal" href="../maintainer/index.html">Maintainer handbook</a></li>
<li class="toctree-l1"><a class="reference internal" href="../process/index.html">All development-process docs</a></li>
</ul>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../core-api/index.html">Core API</a></li>
<li class="toctree-l1"><a class="reference internal" href="../driver-api/index.html">Driver APIs</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../subsystem-apis.html">Subsystems</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="../subsystem-apis.html#core-subsystems">Core subsystems</a></li>
<li class="toctree-l2"><a class="reference internal" href="../subsystem-apis.html#human-interfaces">Human interfaces</a></li>
<li class="toctree-l2 current"><a class="reference internal" href="../subsystem-apis.html#networking-interfaces">Networking interfaces</a><ul class="current">
<li class="toctree-l3 current"><a class="reference internal" href="index.html">Networking</a></li>
<li class="toctree-l3"><a class="reference internal" href="../netlabel/index.html">NetLabel</a></li>
<li class="toctree-l3"><a class="reference internal" href="../infiniband/index.html">InfiniBand</a></li>
<li class="toctree-l3"><a class="reference internal" href="../isdn/index.html">ISDN</a></li>
<li class="toctree-l3"><a class="reference internal" href="../mhi/index.html">MHI</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../subsystem-apis.html#storage-interfaces">Storage interfaces</a></li>
<li class="toctree-l2"><a class="reference internal" href="../subsystem-apis.html#other-subsystems">Other subsystems</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../locking/index.html">Locking</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../process/license-rules.html">Licensing rules</a></li>
<li class="toctree-l1"><a class="reference internal" href="../doc-guide/index.html">Writing documentation</a></li>
<li class="toctree-l1"><a class="reference internal" href="../dev-tools/index.html">Development tools</a></li>
<li class="toctree-l1"><a class="reference internal" href="../dev-tools/testing-overview.html">Testing guide</a></li>
<li class="toctree-l1"><a class="reference internal" href="../kernel-hacking/index.html">Hacking guide</a></li>
<li class="toctree-l1"><a class="reference internal" href="../trace/index.html">Tracing</a></li>
<li class="toctree-l1"><a class="reference internal" href="../fault-injection/index.html">Fault injection</a></li>
<li class="toctree-l1"><a class="reference internal" href="../livepatch/index.html">Livepatching</a></li>
<li class="toctree-l1"><a class="reference internal" href="../rust/index.html">Rust</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../admin-guide/index.html">Administration</a></li>
<li class="toctree-l1"><a class="reference internal" href="../kbuild/index.html">Build system</a></li>
<li class="toctree-l1"><a class="reference internal" href="../admin-guide/reporting-issues.html">Reporting issues</a></li>
<li class="toctree-l1"><a class="reference internal" href="../tools/index.html">Userspace tools</a></li>
<li class="toctree-l1"><a class="reference internal" href="../userspace-api/index.html">Userspace API</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../firmware-guide/index.html">Firmware</a></li>
<li class="toctree-l1"><a class="reference internal" href="../devicetree/index.html">Firmware and Devicetree</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../arch/index.html">CPU architectures</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../staging/index.html">Unsorted documentation</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../translations/index.html">Translations</a></li>
</ul>
</div>
<script type="text/javascript"> <!--
var sbar = document.getElementsByClassName("sphinxsidebar")[0];
let currents = document.getElementsByClassName("current")
if (currents.length) {
sbar.scrollTop = currents[currents.length - 1].offsetTop;
}
--> </script>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/networking/netconsole.rst.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
</div>
</div>
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<section id="netconsole">
<h1>Netconsole<a class="headerlink" href="#netconsole" title="Link to this heading">¶</a></h1>
<p>started by Ingo Molnar <<a class="reference external" href="mailto:mingo%40redhat.com">mingo<span>@</span>redhat<span>.</span>com</a>>, 2001.09.17</p>
<p>2.6 port and netpoll api by Matt Mackall <<a class="reference external" href="mailto:mpm%40selenic.com">mpm<span>@</span>selenic<span>.</span>com</a>>, Sep 9 2003</p>
<p>IPv6 support by Cong Wang <<a class="reference external" href="mailto:xiyou.wangcong%40gmail.com">xiyou<span>.</span>wangcong<span>@</span>gmail<span>.</span>com</a>>, Jan 1 2013</p>
<p>Extended console support by Tejun Heo <<a class="reference external" href="mailto:tj%40kernel.org">tj<span>@</span>kernel<span>.</span>org</a>>, May 1 2015</p>
<p>Release prepend support by Breno Leitao <<a class="reference external" href="mailto:leitao%40debian.org">leitao<span>@</span>debian<span>.</span>org</a>>, Jul 7 2023</p>
<p>Userdata append support by Matthew Wood <<a class="reference external" href="mailto:thepacketgeek%40gmail.com">thepacketgeek<span>@</span>gmail<span>.</span>com</a>>, Jan 22 2024</p>
<p>Sysdata append support by Breno Leitao <<a class="reference external" href="mailto:leitao%40debian.org">leitao<span>@</span>debian<span>.</span>org</a>>, Jan 15 2025</p>
<section id="introduction">
<h2>Introduction:<a class="headerlink" href="#introduction" title="Link to this heading">¶</a></h2>
<p>This module logs kernel printk messages over UDP allowing debugging of
problem where disk logging fails and serial consoles are impractical.</p>
<p>It can be used either built-in or as a module. As a built-in,
netconsole initializes immediately after NIC cards and will bring up
the specified interface as soon as possible. While this doesn’t allow
capture of early kernel panics, it does capture most of the boot
process.</p>
</section>
<section id="sender-and-receiver-configuration">
<h2>Sender and receiver configuration:<a class="headerlink" href="#sender-and-receiver-configuration" title="Link to this heading">¶</a></h2>
<p>It takes a string configuration parameter “netconsole” in the
following format:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>netconsole=[+][r][src-port]@[src-ip]/[<dev>],[tgt-port]@<tgt-ip>/[tgt-macaddr]
where
+ if present, enable extended console support
r if present, prepend kernel version (release) to the message
src-port source for UDP packets (defaults to 6665)
src-ip source IP to use (interface address)
dev network interface name (eth0) or MAC address
tgt-port port for logging agent (6666)
tgt-ip IP address for logging agent
tgt-macaddr ethernet MAC address for logging agent (broadcast)
</pre></div>
</div>
<p>Examples:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>linux netconsole=4444@10.0.0.1/eth1,9353@10.0.0.2/12:34:56:78:9a:bc
</pre></div>
</div>
<p>or:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>insmod netconsole netconsole=@/,@10.0.0.2/
</pre></div>
</div>
<p>or using IPv6:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>insmod netconsole netconsole=@/,@fd00:1:2:3::1/
</pre></div>
</div>
<p>or using a MAC address to select the egress interface:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>linux netconsole=4444@10.0.0.1/22:33:44:55:66:77,9353@10.0.0.2/12:34:56:78:9a:bc
</pre></div>
</div>
<p>It also supports logging to multiple remote agents by specifying
parameters for the multiple agents separated by semicolons and the
complete string enclosed in “quotes”, thusly:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>modprobe netconsole netconsole="@/,@10.0.0.2/;@/eth1,6892@10.0.0.3/"
</pre></div>
</div>
<p>Built-in netconsole starts immediately after the TCP stack is
initialized and attempts to bring up the supplied dev at the supplied
address.</p>
<p>The remote host has several options to receive the kernel messages,
for example:</p>
<ol class="arabic">
<li><p>syslogd</p></li>
<li><p>netcat</p>
<p>On distributions using a BSD-based netcat version (e.g. Fedora,
openSUSE and Ubuntu) the listening port must be specified without
the -p switch:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span> nc -u -l -p <port>' / 'nc -u -l <port>
or::
netcat -u -l -p <port>' / 'netcat -u -l <port>
</pre></div>
</div>
</li>
<li><p>socat</p></li>
</ol>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>socat udp-recv:<port> -
</pre></div>
</div>
</section>
<section id="dynamic-reconfiguration">
<h2>Dynamic reconfiguration:<a class="headerlink" href="#dynamic-reconfiguration" title="Link to this heading">¶</a></h2>
<p>Dynamic reconfigurability is a useful addition to netconsole that enables
remote logging targets to be dynamically added, removed, or have their
parameters reconfigured at runtime from a configfs-based userspace interface.</p>
<p>To include this feature, select CONFIG_NETCONSOLE_DYNAMIC when building the
netconsole module (or kernel, if netconsole is built-in).</p>
<p>Some examples follow (where configfs is mounted at the /sys/kernel/config
mountpoint).</p>
<p>To add a remote logging target (target names can be arbitrary):</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>cd /sys/kernel/config/netconsole/
mkdir target1
</pre></div>
</div>
<p>Note that newly created targets have default parameter values (as mentioned
above) and are disabled by default -- they must first be enabled by writing
“1” to the “enabled” attribute (usually after setting parameters accordingly)
as described below.</p>
<p>To remove a target:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>rmdir /sys/kernel/config/netconsole/othertarget/
</pre></div>
</div>
<p>The interface exposes these parameters of a netconsole target to userspace:</p>
<blockquote>
<div><table class="docutils align-default">
<tbody>
<tr class="row-odd"><td><p>enabled</p></td>
<td><p>Is this target currently enabled?</p></td>
<td><p>(read-write)</p></td>
</tr>
<tr class="row-even"><td><p>extended</p></td>
<td><p>Extended mode enabled</p></td>
<td><p>(read-write)</p></td>
</tr>
<tr class="row-odd"><td><p>release</p></td>
<td><p>Prepend kernel release to message</p></td>
<td><p>(read-write)</p></td>
</tr>
<tr class="row-even"><td><p>dev_name</p></td>
<td><p>Local network interface name</p></td>
<td><p>(read-write)</p></td>
</tr>
<tr class="row-odd"><td><p>local_port</p></td>
<td><p>Source UDP port to use</p></td>
<td><p>(read-write)</p></td>
</tr>
<tr class="row-even"><td><p>remote_port</p></td>
<td><p>Remote agent’s UDP port</p></td>
<td><p>(read-write)</p></td>
</tr>
<tr class="row-odd"><td><p>local_ip</p></td>
<td><p>Source IP address to use</p></td>
<td><p>(read-write)</p></td>
</tr>
<tr class="row-even"><td><p>remote_ip</p></td>
<td><p>Remote agent’s IP address</p></td>
<td><p>(read-write)</p></td>
</tr>
<tr class="row-odd"><td><p>local_mac</p></td>
<td><p>Local interface’s MAC address</p></td>
<td><p>(read-only)</p></td>
</tr>
<tr class="row-even"><td><p>remote_mac</p></td>
<td><p>Remote agent’s MAC address</p></td>
<td><p>(read-write)</p></td>
</tr>
<tr class="row-odd"><td><p>transmit_errors</p></td>
<td><p>Number of packet send errors</p></td>
<td><p>(read-only)</p></td>
</tr>
</tbody>
</table>
</div></blockquote>
<p>The “enabled” attribute is also used to control whether the parameters of
a target can be updated or not -- you can modify the parameters of only
disabled targets (i.e. if “enabled” is 0).</p>
<p>To update a target’s parameters:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>cat enabled # check if enabled is 1
echo 0 > enabled # disable the target (if required)
echo eth2 > dev_name # set local interface
echo 10.0.0.4 > remote_ip # update some parameter
echo cb:a9:87:65:43:21 > remote_mac # update more parameters
echo 1 > enabled # enable target again
</pre></div>
</div>
<p>You can also update the local interface dynamically. This is especially
useful if you want to use interfaces that have newly come up (and may not
have existed when netconsole was loaded / initialized).</p>
<p>Netconsole targets defined at boot time (or module load time) with the
<cite>netconsole=</cite> param are assigned the name <cite>cmdline<index></cite>. For example, the
first target in the parameter is named <cite>cmdline0</cite>. You can control and modify
these targets by creating configfs directories with the matching name.</p>
<p>Let’s suppose you have two netconsole targets defined at boot time:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>netconsole=4444@10.0.0.1/eth1,9353@10.0.0.2/12:34:56:78:9a:bc;4444@10.0.0.1/eth1,9353@10.0.0.3/12:34:56:78:9a:bc
</pre></div>
</div>
<p>You can modify these targets in runtime by creating the following targets:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>mkdir cmdline0
cat cmdline0/remote_ip
10.0.0.2
mkdir cmdline1
cat cmdline1/remote_ip
10.0.0.3
</pre></div>
</div>
<section id="append-user-data">
<h3>Append User Data<a class="headerlink" href="#append-user-data" title="Link to this heading">¶</a></h3>
<p>Custom user data can be appended to the end of messages with netconsole
dynamic configuration enabled. User data entries can be modified without
changing the “enabled” attribute of a target.</p>
<p>Directories (keys) under <cite>userdata</cite> are limited to 53 character length, and
data in <cite>userdata/<key>/value</cite> are limited to 200 bytes:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>cd /sys/kernel/config/netconsole && mkdir cmdline0
cd cmdline0
mkdir userdata/foo
echo bar > userdata/foo/value
mkdir userdata/qux
echo baz > userdata/qux/value
</pre></div>
</div>
<p>Messages will now include this additional user data:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>echo "This is a message" > /dev/kmsg
</pre></div>
</div>
<p>Sends:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>12,607,22085407756,-;This is a message
foo=bar
qux=baz
</pre></div>
</div>
<p>Preview the userdata that will be appended with:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>cd /sys/kernel/config/netconsole/cmdline0/userdata
for f in `ls userdata`; do echo $f=$(cat userdata/$f/value); done
</pre></div>
</div>
<p>If a <cite>userdata</cite> entry is created but no data is written to the <cite>value</cite> file,
the entry will be omitted from netconsole messages:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>cd /sys/kernel/config/netconsole && mkdir cmdline0
cd cmdline0
mkdir userdata/foo
echo bar > userdata/foo/value
mkdir userdata/qux
</pre></div>
</div>
<p>The <cite>qux</cite> key is omitted since it has no value:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>echo "This is a message" > /dev/kmsg
12,607,22085407756,-;This is a message
foo=bar
</pre></div>
</div>
<p>Delete <cite>userdata</cite> entries with <cite>rmdir</cite>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>rmdir /sys/kernel/config/netconsole/cmdline0/userdata/qux
</pre></div>
</div>
<div class="admonition warning">
<p class="admonition-title">Warning</p>
<p>When writing strings to user data values, input is broken up per line in
configfs store calls and this can cause confusing behavior:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>mkdir userdata/testing
printf "val1\nval2" > userdata/testing/value
# userdata store value is called twice, first with "val1\n" then "val2"
# so "val2" is stored, being the last value stored
cat userdata/testing/value
val2
</pre></div>
</div>
<p>It is recommended to not write user data values with newlines.</p>
</div>
</section>
<section id="task-name-auto-population-in-userdata">
<h3>Task name auto population in userdata<a class="headerlink" href="#task-name-auto-population-in-userdata" title="Link to this heading">¶</a></h3>
<p>Inside the netconsole configfs hierarchy, there is a file called
<cite>taskname_enabled</cite> under the <cite>userdata</cite> directory. This file is used to enable
or disable the automatic task name population feature. This feature
automatically populates the current task name that is scheduled in the CPU
sneding the message.</p>
<p>To enable task name auto-population:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>echo 1 > /sys/kernel/config/netconsole/target1/userdata/taskname_enabled
</pre></div>
</div>
<p>When this option is enabled, the netconsole messages will include an additional
line in the userdata field with the format <cite>taskname=<task name></cite>. This allows
the receiver of the netconsole messages to easily find which application was
currently scheduled when that message was generated, providing extra context
for kernel messages and helping to categorize them.</p>
<p>Example:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>echo "This is a message" > /dev/kmsg
12,607,22085407756,-;This is a message
taskname=echo
</pre></div>
</div>
<p>In this example, the message was generated while “echo” was the current
scheduled process.</p>
</section>
<section id="kernel-release-auto-population-in-userdata">
<h3>Kernel release auto population in userdata<a class="headerlink" href="#kernel-release-auto-population-in-userdata" title="Link to this heading">¶</a></h3>
<p>Within the netconsole configfs hierarchy, there is a file named <cite>release_enabled</cite>
located in the <cite>userdata</cite> directory. This file controls the kernel release
(version) auto-population feature, which appends the kernel release information
to userdata dictionary in every message sent.</p>
<p>To enable the release auto-population:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>echo 1 > /sys/kernel/config/netconsole/target1/userdata/release_enabled
</pre></div>
</div>
<p>Example:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>echo "This is a message" > /dev/kmsg
12,607,22085407756,-;This is a message
release=6.14.0-rc6-01219-g3c027fbd941d
</pre></div>
</div>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>This feature provides the same data as the “release prepend” feature.
However, in this case, the release information is appended to the userdata
dictionary rather than being included in the message header.</p>
</div>
</section>
<section id="cpu-number-auto-population-in-userdata">
<h3>CPU number auto population in userdata<a class="headerlink" href="#cpu-number-auto-population-in-userdata" title="Link to this heading">¶</a></h3>
<p>Inside the netconsole configfs hierarchy, there is a file called
<cite>cpu_nr</cite> under the <cite>userdata</cite> directory. This file is used to enable or disable
the automatic CPU number population feature. This feature automatically
populates the CPU number that is sending the message.</p>
<p>To enable the CPU number auto-population:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>echo 1 > /sys/kernel/config/netconsole/target1/userdata/cpu_nr
</pre></div>
</div>
<p>When this option is enabled, the netconsole messages will include an additional
line in the userdata field with the format <cite>cpu=<cpu_number></cite>. This allows the
receiver of the netconsole messages to easily differentiate and demultiplex
messages originating from different CPUs, which is particularly useful when
dealing with parallel log output.</p>
<p>Example:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>echo "This is a message" > /dev/kmsg
12,607,22085407756,-;This is a message
cpu=42
</pre></div>
</div>
<p>In this example, the message was sent by CPU 42.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>If the user has set a conflicting <cite>cpu</cite> key in the userdata dictionary,
both keys will be reported, with the kernel-populated entry appearing after
the user one. For example:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span># User-defined CPU entry
mkdir -p /sys/kernel/config/netconsole/target1/userdata/cpu
echo "1" > /sys/kernel/config/netconsole/target1/userdata/cpu/value
</pre></div>
</div>
<p>Output might look like:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>12,607,22085407756,-;This is a message
cpu=1
cpu=42 # kernel-populated value
</pre></div>
</div>
</div>
</section>
<section id="message-id-auto-population-in-userdata">
<h3>Message ID auto population in userdata<a class="headerlink" href="#message-id-auto-population-in-userdata" title="Link to this heading">¶</a></h3>
<p>Within the netconsole configfs hierarchy, there is a file named <cite>msgid_enabled</cite>
located in the <cite>userdata</cite> directory. This file controls the message ID
auto-population feature, which assigns a numeric id to each message sent to a
given target and appends the ID to userdata dictionary in every message sent.</p>
<p>The message ID is generated using a per-target 32 bit counter that is
incremented for every message sent to the target. Note that this counter will
eventually wrap around after reaching uint32_t max value, so the message ID is
not globally unique over time. However, it can still be used by the target to
detect if messages were dropped before reaching the target by identifying gaps
in the sequence of IDs.</p>
<p>It is important to distinguish message IDs from the message <sequnum> field.
Some kernel messages may never reach netconsole (for example, due to printk
rate limiting). Thus, a gap in <sequnum> cannot be solely relied upon to
indicate that a message was dropped during transmission, as it may never have
been sent via netconsole. The message ID, on the other hand, is only assigned
to messages that are actually transmitted via netconsole.</p>
<p>Example:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>echo "This is message #1" > /dev/kmsg
echo "This is message #2" > /dev/kmsg
13,434,54928466,-;This is message #1
msgid=1
13,435,54934019,-;This is message #2
msgid=2
</pre></div>
</div>
</section>
</section>
<section id="extended-console">
<h2>Extended console:<a class="headerlink" href="#extended-console" title="Link to this heading">¶</a></h2>
<p>If ‘+’ is prefixed to the configuration line or “extended” config file
is set to 1, extended console support is enabled. An example boot
param follows:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>linux netconsole=+4444@10.0.0.1/eth1,9353@10.0.0.2/12:34:56:78:9a:bc
</pre></div>
</div>
<p>Log messages are transmitted with extended metadata header in the
following format which is the same as /dev/kmsg:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span><level>,<sequnum>,<timestamp>,<contflag>;<message text>
</pre></div>
</div>
<p>If ‘r’ (release) feature is enabled, the kernel release version is
prepended to the start of the message. Example:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>6.4.0,6,444,501151268,-;netconsole: network logging started
</pre></div>
</div>
<p>Non printable characters in <message text> are escaped using “xff”
notation. If the message contains optional dictionary, verbatim
newline is used as the delimiter.</p>
<p>If a message doesn’t fit in certain number of bytes (currently 1000),
the message is split into multiple fragments by netconsole. These
fragments are transmitted with “ncfrag” header field added:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>ncfrag=<byte-offset>/<total-bytes>
</pre></div>
</div>
<p>For example, assuming a lot smaller chunk size, a message “the first
chunk, the 2nd chunk.” may be split as follows:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>6,416,1758426,-,ncfrag=0/31;the first chunk,
6,416,1758426,-,ncfrag=16/31; the 2nd chunk.
</pre></div>
</div>
</section>
<section id="miscellaneous-notes">
<h2>Miscellaneous notes:<a class="headerlink" href="#miscellaneous-notes" title="Link to this heading">¶</a></h2>
<div class="admonition warning">
<p class="admonition-title">Warning</p>
<p>the default target ethernet setting uses the broadcast
ethernet address to send packets, which can cause increased load on
other systems on the same ethernet segment.</p>
</div>
<div class="admonition tip">
<p class="admonition-title">Tip</p>
<p>some LAN switches may be configured to suppress ethernet broadcasts
so it is advised to explicitly specify the remote agents’ MAC addresses
from the config parameters passed to netconsole.</p>
</div>
<div class="admonition tip">
<p class="admonition-title">Tip</p>
<p>to find out the MAC address of, say, 10.0.0.2, you may try using:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>ping -c 1 10.0.0.2 ; /sbin/arp -n | grep 10.0.0.2
</pre></div>
</div>
</div>
<div class="admonition tip">
<p class="admonition-title">Tip</p>
<p>in case the remote logging agent is on a separate LAN subnet than
the sender, it is suggested to try specifying the MAC address of the
default gateway (you may use /sbin/route -n to find it out) as the
remote MAC address instead.</p>
</div>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>the network device (eth1 in the above case) can run any kind
of other network traffic, netconsole is not intrusive. Netconsole
might cause slight delays in other traffic if the volume of kernel
messages is high, but should have no other impact.</p>
</div>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>if you find that the remote logging agent is not receiving or
printing all messages from the sender, it is likely that you have set
the “console_loglevel” parameter (on the sender) to only send high
priority messages to the console. You can change this at runtime using:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>dmesg -n 8
</pre></div>
</div>
<p>or by specifying “debug” on the kernel command line at boot, to send
all kernel messages to the console. A specific value for this parameter
can also be set using the “loglevel” kernel boot option. See the
dmesg(8) man page and <a class="reference internal" href="../admin-guide/kernel-parameters.html"><span class="doc">The kernel’s command-line parameters</span></a>
for details.</p>
</div>
<p>Netconsole was designed to be as instantaneous as possible, to
enable the logging of even the most critical kernel bugs. It works
from IRQ contexts as well, and does not enable interrupts while
sending packets. Due to these unique needs, configuration cannot
be more automatic, and some fundamental limitations will remain:
only IP networks, UDP packets and ethernet devices are supported.</p>
</section>
</section>
</div>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="footer">
©The kernel development community.
|
Powered by <a href="https://www.sphinx-doc.org/">Sphinx 8.1.3</a>
& <a href="https://alabaster.readthedocs.io">Alabaster 0.7.16</a>
|
<a href="../_sources/networking/netconsole.rst.txt"
rel="nofollow">Page source</a>
</div>
</body>
</html>