Junior — Middle
How to determine the location of application log files in a Linux operating system?
sobes.tech AI
Answer from AI
In Linux, the location of application log files usually depends on the type of application and its configuration, but there are some standard places:
/var/log/— the main directory for system and application logs.- Inside
/var/log/, there may be subdirectories for specific services, such as/var/log/nginx/or/var/log/mysql/.
To determine the exact location of log files for a specific application, you can:
- Check the application's documentation.
- Review the application's configuration files, where the log path is usually specified.
- Use commands like
ps aux | grep process_nameto find the running process and examine its startup parameters. - Use
systemctl status service_nameorjournalctlto view system logs if the application runs as a service.
For example, to view nginx logs, you can look at /var/log/nginx/access.log and /var/log/nginx/error.log.