As with all operating systems, logs are also generated and stored on Linux-based systems. Log files are the records of all activities that took place on a system. The following are the general locations of the Linux log files:
The following are additional log locations on Linux systems:
- Example 1: Clearing logs using null
In this example, we are going to use null, a non-existent object, to remove the contents of a file. We are going to clear the logs of the Apache access.log file on a Linux system. A null object is an entity without any attributes or characteristics in an operating system.
To discover the location of a file, use the locate command followed by the filename. In this exercise, we use the locate access.log command to show us the location of all files that contain the access.log string sequence: