title: How to change log level of dmesg programmatically?
body: <p>I want to change the mask priority of dmesg by which i want to print only those messages whose priority is highest. So how to change these priority programmatically?</p>
  
  <p><code>Like if printk priority is KERN_ALERT or less than this then no message will printed in dmesg or console. I want only KERN_EMERG messages in dmesg.</code></p>
  
  <p>1 solution i have is just edit the printk proc file like -</p>
  
  <p><code>echo 0 &gt;/proc/sys/kernel/printk</code></p>
  
  <p>But i want a <code>Kernel Space</code> API to do this.</p>
  
  <p>I have used <code>setlogmask</code> also,but it was not working.</p>
  
  <p><code>Is do_syslog works here ??</code></p>
  
  <p>If yes then how??</p>
  
  <p>I am writting a prog file to do this,like i want to  change the log-level of dmesg through that proc file.So is there any idea to do this?</p>
  
  <p>Thanks in advance..</p>