There are also different log files available within our system, including Apache log. In our Linux distribution, the log files are in the /var/log/ folder within the root filesystem as shown here:
In the preceding screenshot, we can easily see the different types of log files (for instance, authentication log file auth.log, system log file syslog, and kernel log kern.log) available for different operations entries. As we perform operations on Apache log files, as shown previously, we can also perform the same kind of operations on local log files. Let's see an example for parsing one of the log files from before. Create a simple_log.py script and write the following content in it:
f=open('/var/log/kern.log','r')
lines = f.readlines()
for line in lines:
kern_log = line.split()
print(kern_log)
f.close()
Run the...