How are log files named

conventionsfilenameslogs

Or what can we infer from the names of log files?

For example, when I want to check the Xorg logs, I find three files:

Xorg.0.log      
Xorg.0.log.old
Xorg.1.log

You can also find many such log files under /var/log/:

$ ls /var/log/*log*
/var/log/alternatives.log        /var/log/dpkg.log.4.gz
/var/log/alternatives.log.1      /var/log/dpkg.log.5.gz
/var/log/alternatives.log.10.gz  /var/log/dpkg.log.6.gz
/var/log/alternatives.log.11.gz  /var/log/dpkg.log.7.gz
/var/log/alternatives.log.12.gz  /var/log/dpkg.log.8.gz
/var/log/alternatives.log.2.gz   /var/log/dpkg.log.9.gz
/var/log/alternatives.log.3.gz   /var/log/faillog
/var/log/alternatives.log.4.gz   /var/log/fontconfig.log
/var/log/alternatives.log.5.gz   /var/log/kern.log
/var/log/alternatives.log.6.gz   /var/log/kern.log.1
/var/log/alternatives.log.7.gz   /var/log/kern.log.2.gz
/var/log/alternatives.log.8.gz   /var/log/kern.log.3.gz
/var/log/alternatives.log.9.gz   /var/log/kern.log.4.gz
/var/log/apport.log              /var/log/lastlog
/var/log/apport.log.1            /var/log/mail.log
/var/log/apport.log.2.gz         /var/log/mail.log.1
/var/log/apport.log.3.gz         /var/log/mail.log.2.gz
/var/log/apport.log.4.gz         /var/log/mail.log.3.gz
/var/log/apport.log.5.gz         /var/log/mail.log.4.gz
/var/log/apport.log.6.gz         /var/log/mysql.log
/var/log/apport.log.7.gz         /var/log/mysql.log.1.gz
/var/log/auth.log                /var/log/mysql.log.2.gz
/var/log/auth.log.1              /var/log/mysql.log.3.gz
/var/log/auth.log.2.gz           /var/log/mysql.log.4.gz
/var/log/auth.log.3.gz           /var/log/mysql.log.5.gz
/var/log/auth.log.4.gz           /var/log/mysql.log.6.gz
/var/log/boot.log                /var/log/mysql.log.7.gz
/var/log/bootstrap.log           /var/log/syslog
/var/log/dpkg.log                /var/log/syslog.1
/var/log/dpkg.log.1              /var/log/syslog.2.gz
/var/log/dpkg.log.10.gz          /var/log/syslog.3.gz
/var/log/dpkg.log.11.gz          /var/log/syslog.4.gz
/var/log/dpkg.log.12.gz          /var/log/syslog.5.gz
/var/log/dpkg.log.2.gz           /var/log/syslog.6.gz
/var/log/dpkg.log.3.gz           /var/log/syslog.7.gz

So what do the numbers indicate? Also what is the difference between log and log.old?

Best Answer

Log files indicate different things depending on the application they're for because every application implements logging in their own way. There are some standards that are commonly followed, but there is nothing that forces an application to adhere to any particular logging strategy. So for any given application you should check its man page to try to figure out how it implements logging. After that try google.

The most common practice is to name log files with a .log extension to indicate they are logs. Log files are also commonly placed either in /var/log/ or in the applications install directory.

As for Xorg logs, the number indicates the display number (0 is your first display, 1 should be your second). The .old extension indicates that the log file is for the previous x session.

Related Question