0

I have a VM that works on the Azure cloud. It is Centos 7.8. The problem which I have is related to the /var/log/messages file. It works for several days without an issue. Then, the "messages" file gets bigger and bigger.

It gets only one message billions of times until the disk is full. It has 30GB of storage. The message is "Cannot open log file". I don't know which process is causing this error message.

Is there a way to mute this file or identify the underlying problem?

Edit: Jul 16 21:42:04 database pgagent_14: file!Can not open the logfile!

I found the root cause finally.

  • the `messages` log mentions the source as well, could you copy-paste one full line of this error message... – redseven Jul 14 '22 at 12:35

1 Answers1

0

Fine tune logrotate with more compression.

lograte.conf

# see "man logrotate" for details

# global options do not affect preceding include directives

# rotate log files weekly
weekly

# keep 4 weeks worth of backlogs
rotate 4

# create new (empty) log files after rotating old ones
create

# use date as a suffix of the rotated file
dateext

# uncomment this if you want your log files compressed
compress

# packages drop log rotation information into this directory
include /etc/logrotate.d

# system-specific logs may also be configured here.

he most important log file in Linux is the /var/log/messages file, which records a variety of events, such as the system error messages, system startups and shutdowns, change in the network configuration, etc. This is usually the first place to look at in case of problems. This file is a plain text file, so you can check it using any tool that can examine text files, such as less. You can also use the tail command to display the last 10 lines of this file:

Or using something like this:

cat /var/log/messages | grep error | more
Ace
  • 478
  • 1
  • 6