LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   what are rotated logs (https://www.linuxquestions.org/questions/linux-newbie-8/what-are-rotated-logs-4175422771/)

kedarp 08-18-2012 09:29 AM

what are rotated logs
 
I have been using linux for the lat 2 years.
But I came across "Rotated logs" term for the first time. What are they and what is their purpose?

gregAstley 08-18-2012 10:01 AM

Quote:

Originally Posted by kedarp (Post 4757608)
I have been using linux for the lat 2 years.
But I came across "Rotated logs" term for the first time. What are they and what is their purpose?

Hi, I was intrigued enough to have a look at this myself (see perhaps http://www-uxsup.csx.cam.ac.uk/~jw35...html/x1670.htm)

An explanation in my own words wouldn't be better than you'll find here but essentially instead of putting all your logging info into one big old log file you can have some ordered set of log files {file_1, ..., file_n} where the newest logs are sent to file_n (and file_{n+1} is created (probably automatically) at some point in the future) and the oldest logs are in file_1 (which will be deleted when file_{n+1} is created)

Helps make the logs you want easier to find and get rid of stuff you don't care about without messing with the file containing logs you want to keep

chrism01 08-19-2012 07:17 PM

Actually, the lowest numbered log is the most recent; numbers go up as logs are aged+rotated.
In fact, the current log being written to is the un-numbered one eg
Code:

ls -lt /var/log/mess*
-rw------- 1 root root 1496907 Aug 20 10:14 messages
-rw------- 1 root root 8333239 Aug 19 04:03 messages.1
-rw------- 1 root root 8339166 Aug 12 04:04 messages.2
-rw------- 1 root root 8348313 Aug  5 04:03 messages.3
-rw------- 1 root root 8344887 Jul 29 04:04 messages.4

Note that this is the default scheme. The re-naming scheme can be specified to be other things eg use the date in format YYYYMMDD, which will sort easily/naturally.

gregAstley 08-20-2012 01:37 PM

Quote:

Originally Posted by chrism01 (Post 4758573)
Actually, the lowest numbered log is the most recent; numbers go up as logs are aged+rotated.
In fact, the current log being written to is the un-numbered one eg
Code:

ls -lt /var/log/mess*
-rw------- 1 root root 1496907 Aug 20 10:14 messages
-rw------- 1 root root 8333239 Aug 19 04:03 messages.1
-rw------- 1 root root 8339166 Aug 12 04:04 messages.2
-rw------- 1 root root 8348313 Aug  5 04:03 messages.3
-rw------- 1 root root 8344887 Jul 29 04:04 messages.4

Note that this is the default scheme. The re-naming scheme can be specified to be other things eg use the date in format YYYYMMDD, which will sort easily/naturally.

Fair enough, thanks for the correction. That said, as much as I made a poor job of it I was more interested in the fact that the set of logs are ordered (in some way); to me the elements in some set of files {file_1, ..., file_n} are labeled for ease of notation as opposed to being suggestive of a naming scheme.


All times are GMT -5. The time now is 05:23 AM.