Check Your Linux Kernel Log For Errors With ‘dmesg’

You can check your kernel logs for errors with dmesg, if you need to. I previously wrote an article about checking your error logs with KSystemLog and checking the error logs graphically is my preferred way to check for errors. KSystemLog also shows more than just kernel logs.

However, a GUI environment is not always an option and you can use ‘dmesg‘ in a pinch. This will only output the kernel ring buffer. There are other other error logs, so this is just one way. Future articles will cover ways to read other logs.

The ‘dmesg’ application stands for ‘diagnostic message’ and prints the ring buffer from the kernel. Run by itself, it’ll output  a ton of information, so this article will also help you try to make sense of the output.

If you’re curious, the man page defines dmesg as:

dmesg – print or control the kernel ring buffer

And, well, that’s what it does. It does what it says on the tin. The buffer it’s reading is full of information, messages the kernel has left. Not all that information is about errors, but in those messages are error notifications.

Running dmesg by itself is likely a bit overwhelming. Feel free to try it out right now. Crack open your terminal, just press CTRL + ALT + T, and enter the following:

The output is way more information than you probably want to wade through – especially while being frustrated. So, let’s see if we can make this data more useful.

Read Error Messages With ‘dmesg’:

I hope you opened your terminal in the entry section. If you didn’t, you should do so now. Go ahead and open it, I’ll wait here until you’re back…

We already know that running dmesg by itself throws a ton of output. It’s the data in the kernel ring buffer and it’d be exhausting to go through it line by line.

So, first, if you’re checking the logs then there’s likely a reason. That reason will help you with this next command. You’ll need a pipe and grep so that you can process the output more easily. Let’s say you’re having monitor issues, which would lead you to try:

You can grep for other things, such as “Audio” or even “Mouse”. Go ahead and give those a try. You may have errors you don’t even know about.

Most of the time, dmesg is pretty uninteresting. You can actually filter it further, often to just a few lines – by just showing the lines that contain errors. To do that, just try:

If you want to clear out the logged data, you can do that easily enough. You will need to use sudo, and the command is:

Those are really the most important aspects of checking your logs for errors with dmesg. You can run man dmesg to learn about a few more options. As far as my experience goes, you won’t really have a need for the other flags.

Again, I wrote an article about KSystemLog and that will graphically show you your logs – including the kernel’s buffer. If you have a choice, you might as well use a GUI for this sort of thing.

Closure:

Yup… There’s another article. It’s one more step towards reaching my goal. Before we know it, that year will have passed and I’ll need to make some decisions. Until then, let’s keep the party rocking.

Thanks for reading! If you want to help, or if the site has helped you, you can donate, register to help, write an article, or buy inexpensive hosting to start your own site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

How To: Graphically Check Your Logs For Errors With ‘KSystemLog’

Today’s article is going to be about one of my favorite tools for checking the various system logs, KSystemLog. Checking your logs for errors has never been easier, and this is one of the first tools I reach for when I have a problem that I don’t know how to solve.

When you first notice a problem with your Linux box, you might only be noticing the symptoms and not actually seeing the reason. Those reasons can often be found by rooting through the various logs to see what’s actually causing the error.

Back in the early computing days it required the terminal to work with your system’s logs. You’d ask for help on a forum and they’d request that you run a command that looked something like this:

It that actually worked and it worked well enough for a long time. It worked even better when you knew what you were looking for and looking at. If you didn’t, you’d scroll through tons of text in the terminal with no real visual cues to sort through the data. Today, there are better tools for this.

Enter KSystemLog:

Thankfully, there’s KSystemLog. KSystemLog’s man page describes it thusly:

Description: system log viewer
KSystemLog show all logs of your system, grouped by General (Default system log, Authentication, Kernel, X.org…), and optional Services (Apache, Cups,etc, …).
It includes many features to read nicely your log files:
* Colorize log lines depending on their severities

* Tabbed view to allow displaying several logs at the same time
* Auto display new lines logged
* Detailed information for each log lines

Which looks like this:

ksystemlog
KSystemlog UI – The images are old and can’t be expanded due to a sudden bout of laziness.

As you see in the image, KSystemLog is a handy GUI that lets view your various system logs. When you look at the image above, you’ll be able see that one of the lines is a darker blue than the previous lines. This is because it’s a new entry, an event that happened after the application had been opened.

That means you can open KSystemLog and then open the application that’s giving you trouble. Doing it this way will let you see what log entries are made and what errors are thrown as the application is opened and used. Of course, you can always examine the entire log of errors and events. 

Even better, the events in the logs can be color-coded, providing easy visual cues. The events range in color, indicating severity, of from a light gray (normal) to a bright red for emergency-level events. You can even filter and search for events.

error messages in kystemlog
Note the color change for errors.

KSystemLog is a KDE application but pulls in very, very few dependencies. It starts rapidly and will show the installed log files by default. In a pretty default configuration, it finds these:

ksystemlog logs available
Currently available logs on this system. More are available.

Getting KSystemLog:

Assuming you are using a major distro, it’s almost certain to be your default repositories. For example, if you’re using a Debian derivative (Ubuntu, Mint, etc.) then it can be installed by opening the terminal and entering:

Just adjust the above installation command for your distro’s package manager and you should be good to go. If KDE is an option for your distro, then KSystemLog can’t be far behind.

By the way, you don’t have to know what the errors mean. You can just take the logged errors and use them as search terms to help. Just copy and paste, using the errors verbatim, and search! It’s absolutely amazing how many errors can be resolved by doing just that. I’ve personally used this method to troubleshoot so many times that I’ve decided that it’s a tool we all need in our Linux toolbox.

Closure:

And there you have it, another article. This one is about KSystemLog, a tool that lets you graphically examine your system’s logs. It’s a great tool for wading through long logs and searching for the root cause of various problems. In an ideal world you’d not need such a tool, but this is not an ideal world. It’s a world with bugs and errors, and KSystemLog is a tool for just that.

Thanks for reading! If you want to help, or if the site has helped you, you can donate, register to help, write an article, or buy inexpensive hosting to start your own site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

Subscribe To Our Newsletter
Get notified when new articles are published! It's free and I won't send you any spam.
Linux Tips
Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License.