<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" dir="ltr" style="font-size: 12pt; color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif, "EmojiFont", "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols;">
<p></p>
<div class="_rp_T4" id="Item.MessagePartBody" style="">
<div class="_rp_U4 ms-font-weight-regular ms-font-color-neutralDark rpHighlightAllClass rpHighlightBodyClass" id="Item.MessageUniqueBody" style="font-family:"wf_segoe-ui_normal","Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,"EmojiFont"">
<div class="rps_d79c">
<div>
<div class="BodyFragment"><font size="2"><span style="font-size:10pt">
<div class="PlainText">Hello,<br>
<br>
Recently when using "lctl dk" I have found myself wanting some of the "quality of life" features that exist in the similar linux tool dmesg. In particular, having the ability to "follow" the debug log like "dmesg -w" would be very handy IMO.<br>
<br>
I've attempted to implement this in userspace with the existing tooling (using "lctl debug_daemon" to write the encoded log to a file, and "lctl debug_file" to decode it) but have run into challenges. I first tried creating a FIFO and had debug_daemon write
to it and debug_file read from it. Unfortunately this fails because the kernel thread that writes to this file (tracefiled in libcfs/libcfs/tracefile.c) repeatedly opens and closes the file, but after the first close reading the FIFO fails.</div>
<div class="PlainText"><br>
My next idea was to have debug_daemon write to a regular file and debug_file read it like "tail -f". This should work in theory but has disadvantages: the user must remember to delete the file when done (the tool could do this but not if it exits uncleanly),
and also entries could be missed if the file is deleted while the tool is still running.<br>
<br>
I think the cleanest solution is to rework the debug_kernel interface to be like linux's /dev/kmsg. A character device, perhaps named /dev/lmsg, could be created that outputs the buffer contents when read. <font size="2"><span style="font-size:10pt">Implementing
"follow" would be trivial with this interface. </span></font>The existing userspace tools could also easily be updated to use this interface, and it would bring other benefits, for example "lctl dk" not needing to copy the message buffer to a tmp file. The
disadvantage here is that this could be a significant kernel-side refactor.<br>
<br>
I feel the ability to follow Lustre's debug log would be useful to both sysadmins and developers but want to get some other input. Would this be valuable to anyone? If this would be useful -- and feasible -- I would be happy to submit a JIRA ticket and work
on a patch but wanted to get some more opinions. I'm not very familiar with the kernel side code yet so I'm not sure how complicated this would be.<br>
<br>
- Thomas Bertschinger</div>
</span></font></div>
</div>
</div>
</div>
</div>
<span class="PersonaPaneLauncher">
<div class="_pe_d _pe_62" tabindex="-1"></div>
</span>
<div class="_rp_Z4"></div>
<div class="_rp_j" tabindex="-1" style="">
<div class="_qc_F ms-bg-color-white _qc_G">
<hr class="_qc_B">
</div>
</div>
<p></p>
</div>
</body>
</html>