Skip to content

Conversation

reubenmiller
Copy link
Contributor

@reubenmiller reubenmiller commented Oct 22, 2025

Proposed changes

Add a dmesg log plugin to the out-of-the-box features. The dmesg plugin only provide one type called "all" due to the vast differences in the dmesg implementations (e.g. busybox/bsd don't support filtering by log facility or datetime).

The plugin will attempt to call dmesg with a datetime filter, however if it fails for any reason, then dmesg will be called without any arguments (and in this case all the messages will be returned). This is due to the various implementations of dmesg.

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Improvement (general improvements like code refactoring that doesn't explicitly fix a bug or add any new functionality)
  • Documentation Update (if none of the other choices apply)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Paste Link to the issue


Checklist

  • I have read the CONTRIBUTING doc
  • I have signed the CLA (in all commits with git commit -s. You can activate automatic signing by running just prepare-dev once)
  • I ran just format as mentioned in CODING_GUIDELINES
  • I used just check as mentioned in CODING_GUIDELINES
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

Further comments

@reubenmiller reubenmiller added the theme:troubleshooting Theme: Troubleshooting and remote control label Oct 22, 2025
@codecov
Copy link

codecov bot commented Oct 22, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions
Copy link
Contributor

github-actions bot commented Oct 22, 2025

Robot Results

✅ Passed ❌ Failed ⏭️ Skipped Total Pass % ⏱️ Duration
716 0 3 716 100 2h13m42.769500999s

Signed-off-by: reubenmiller <reuben.d.miller@gmail.com>
@reubenmiller reubenmiller force-pushed the feat-add-dmesg-plugin branch from 789a292 to d14bc05 Compare October 22, 2025 15:38
@reubenmiller reubenmiller marked this pull request as ready for review October 22, 2025 15:40
@reubenmiller reubenmiller requested review from a team and rina23q as code owners October 22, 2025 15:40
printf 'auth\n' # security/authorization messages
printf 'syslog\n' # messages generated internally by syslogd
printf 'lpr\n' # line printer subsystem
printf 'news\n' # network news subsystem
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The standard set seems to be 15 although I came across a few other blogs where that number was 11. But most of the online docs had 15 listed.

Copy link
Contributor Author

@reubenmiller reubenmiller Oct 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rina23q @albinsuresh Ok, since the list seems to vary significantly (depends on the dmesg implementation), I'll refactor to remove all the types (as it will be more predictable for users), and just have a single "all" type.

Do you both agree?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Though I'll still have to add a check to find out when the datetime filtering can be used (as that is also dependent on the implementation).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine to keep only all.
The 15 facilities are based on RFC5424 (syslog protocol). I assume and it seems dmesg doesn't have to align with the facilities defined on RFC5424?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Though the problem is that I don't think that all dmesg implementations support it anyway...so it would just be adding an extra 15 items to the types, where we don't know which ones would work or not.

So if we keep things simple for now, and just have one type, as it is anyway for more advanced usecases (as this is more for powerusers who want to monitor kernel messages to debug driver problems etc.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've updated the PR to used the single "all" type. The PR's description also reflects the updated scope.

Signed-off-by: reubenmiller <reuben.d.miller@gmail.com>
Signed-off-by: reubenmiller <reuben.d.miller@gmail.com>
Copy link
Member

@rina23q rina23q left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment on lines +73 to +74
since="1 day ago"
until="0 second ago"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something is wrong with these defaults. I got no entries when no values is given for --since and --until.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Though that might be because there are no values within the time range (which isn't uncommon)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But you can confirm this by just increasing the look back.

/var/share/tedge/log-plugins/dmesg get all --since "180 days ago" --until "0 second ago"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could change the default to something higher, like 90 days?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

theme:troubleshooting Theme: Troubleshooting and remote control

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants