Operating System - HP-UX
1822408 Members
3019 Online
109642 Solutions
New Discussion юеВ

Re: How to clear message in dmesg with out rebooting the server..

 
ashan
Advisor

How to clear message in dmesg with out rebooting the server..

Hi,

I need to find out how to clear message in dmesg with out rebooting the server. Its it possible...?

Best Regards

Ashan



5 REPLIES 5
V.Tamilvanan
Honored Contributor

Re: How to clear message in dmesg with out rebooting the server..

Hi,
I don't think so. Unless you reboot your server it will not get cleared.
Con O'Kelly
Honored Contributor

Re: How to clear message in dmesg with out rebooting the server..

Sorry I'm not sure about clearing messages from the dmesg buffer without a re-boot.
Don't know if it helps but you can use a "-" flag to dmesg which will only show the messages since it was last run.
i.e # dmesg -
The man page has example for using this in cron.

Cheers
Con
Bill Hassell
Honored Contributor

Re: How to clear message in dmesg with out rebooting the server..

dmesg is a command to read a specific area of memory in the kernel. This area is a fixed size and old messages drop off once the buffer is full. You could scroll the undesired messsage (and all others before it) out of the buffer with some error message but there is no way to delete a string inside this buffer. This is why you need to create a cron job to read dmesg every few minutes and post the new messages to a logfile. This is an example cron entry to track dmesg (and not lose old entries):

# log kernel diagnostic messages every 10 minutes
05,15,25,35,45,55 * * * * /usr/sbin/dmesg - >>/var/adm/dmesg.log

The secret is to run dmesg with the - option that reports only new information.


Bill Hassell, sysadmin
Sridhar Bhaskarla
Honored Contributor

Re: How to clear message in dmesg with out rebooting the server..

Hi Ashan,

If you really want to overwrite the existing dmesg, then you will need to create some errors like filling up a filesystem or forcefully exceeding some kernel parameters like nfile etc.,

You cannot clear the dmesg.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
V.Tamilvanan
Honored Contributor

Re: How to clear message in dmesg with out rebooting the server..

Hi Ashan,
Is it something wrong with my reply ??????????