0

Is there a way how we can capture all the console messages to a file that are coming from different applications in linux.

  • Define 'different applications'. Shell is an application, do you want to capture command prompt too? – gronostaj Jun 26 '15 at 21:31
  • I am working on a embedded linux device and will have applications like multimedia, network or user apps that will keep printing their logs on to console and I want to redirect or have copy of all the logs that come on to console into a file. – Reddy Jun 26 '15 at 23:02
1

in /etc/syslog.conf or /etc/rsyslog.conf add something like below

usually syslog or rsyslog.

*.*                                    -/var/log/allmessages

more advanced options available

# => all acpid messages for debuging (uncomment if needed):
if     ($programname == 'acpid' or $syslogtag == '[acpid]:') then \
       -/var/log/acpid

Using rsyslog you can even log to mysql database.

This can be dangerous as you can fill your hard drive/storage and crash your OS if you don't delete them at some point.

  • I already tried with syslog.conf change but it did not work for me. Might be due to busy box version of syslogd do not have that support. Also I tried with below which did not work, # Log all writes to /dev/console to a separate file. console.* /var/log/console.log – Reddy Jul 2 '15 at 18:35
  • @Reddy Did you add your rule at the very top of the syslog.conf or the bottom? If you added to the end no messages will reach that point. – cybernard Jul 5 '15 at 14:30
  • I have added it at the top of file. kern.debug /logs/kernel.log . /logs/sys.log But its not working. I did not see any kernel.log but I can see logs in sys.log which will only contain logs from different modules but nothing from kernel or console. – Reddy Jul 6 '15 at 20:26
  • using rsyslogd instead syslogd solved the problem for me. Due to some reason syslogd was not working as per the rules defined. – Reddy Oct 6 '15 at 14:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.