Linux Microsoft VMware
Showing posts with label Log. Show all posts
Showing posts with label Log. Show all posts

Wednesday, September 5, 2012

Linux log files location and how do I view logs files?


Q. I am new to Linux and I would like to know where are the log files located under Debian or Cento OS Linux server? How do I open or view log files?

Ans. Almost all logfiles are located under /var/log directory (and subdirectory). You can change to this directory using cd command but you need to be the root user. You can use less, more, cat or tail command to see the logs.

Go to /var/logs directory:

How do I rotate log files?


Q. How do I rotate log files under Linux operating system?

A. You need use tool called logrotate, which is designed to ease administration of systems that generate large numbers of log files. It allows automatic rotation, compression, removal, and mailing of log files.

Each log file may be handled daily, weekly, monthly, or when it grows too large. With this tool you keep logs longer with less disk space.

Default configuration file

The default configuration file is /etc/logrotate.conf:

Powered by Blogger.