-1

We are facing many issues regarding journal error messages and we want to know how to keep messages related to system in /var/log/messages and delete other messages?

Striezel
  • 3,693
  • 7
  • 23
  • 37
mokazo
  • 1
  • 1
    This is a sysadmin question, not programming. And you should keep everything in the journal, and select (filter out) what you want to see (or not). – vonbrand May 16 '18 at 15:24

1 Answers1

0

As @vonbrand already mentioned in the comment, you usually do not want to delete messages from /var/log/messages (or probably any log file, for that matter), because you might loose important information.

What you can do instead is filter the output of log files with tools like grep. For example, if you only want lines from /var/log/messages that contain the character sequence httpd, you could achieve that with

grep "httpd" /var/log/messages

Note that grep also supports regular expressions as search patterns.

Striezel
  • 3,693
  • 7
  • 23
  • 37