Technically, you can mount
/var/log as tmpfs. You'd need to be sure that
/var/log is mounted before
syslogd starts, but that's the case by default on most distributions since they support
/var on a separate partition.
You'll obviously lose all logs, which I guarantee will be a problem one day. Logs are there for a purpose — there're rarely needed, but they're there when they're needed. For example, if your system crashes, what was it doing before the crash? Since when has this package been incstalled? When did I print this document? etc.
You won't gain much disk space: logs don't take much space relative to a hard disk. Check how much space they use on your system; I'd expect something like 0.1% of the disk size.
You won't gain any performance. Logs amount to a negligible part of disk bandwidth on a normal desktop-type configuration.
The only gain would be to allow the disk to stay down, rather than spin up all the time to write new log entries. Spinning the disk down doesn't save much electricity if any: the hard disk is only a small part of a laptop power consumption, and spinning up requires a power surge. Furthermore spin cycles wear down the disk, so don't spin down too often. The main reason to spin down is the noise.
Rather than putting logs on tmpfs, arrange for your disk not to spin up when a file is written. Install Laptop Mode, which causes writes to disk to be suspended while the disk is spun down — only a full write buffer, an explicit sync or a disk read will spin the disk back up.
Depending on your configuration, you may need to instruct the syslog daemon not to call
sync after each write. With the traditional syslog daemon, make sure that all file names in
- before them, e.g.
With rsyslog, also make sure that log file names have
- before them; the log files are configured in