Introduction to logging
As we saw in the introduction, logs are simply informational messages – records of events happening in a software application or operating system. Like many Unix concepts, there are few hard and fast rules: if you write a two-line script that writes a timestamp into a text file, that might count as a log. Some logs are simple plaintext strings sent to well-known file locations on the system, and others are highly structured binary data managed exclusively by a daemon such as systemd
.
As a developer, you’re probably familiar with log levels, which are labels that indicate the urgency of events on your software. Think “error,” “info,” and “debug” messages, which you’ve surely seen scrolling past in the terminal while developing software. We’ll cover these common log levels later, but for now, you should be aware of three main sources of logs in a modern, full-featured Linux environment...