Where are Apache log files on my server?
1. Finding Linux / FreeBSD operating system distribtion and version
Before finding location of Apache log files it is useful to check what is the remote / local Linux operating system version, hence
First thing to do when you login to your remote Linux server is to check what kind of GNU / Linux you're dealing with:
cat /etc/issue
cat /etc/issue.net
In most GNU / Linux distributions should give you enough information about the exact Linux distribution and version remote server is running.
You will get outputs like
# cat /etc/issue
SUSE LINUX Enterprise Server 10.2 Kernel r (m), l
or
# cat /etc/issue
Debian GNU/Linux 8 n l
If remote Linux is Fedora look for fedora-release file:
cat /etc/fedora-release Fedora release 7 (Moonshine)
The proposed freedesktop.org standard with the introduction of systemd across all Linux distributions is
/etc/os-release
# cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 8 (jessie)"
NAME="Debian GNU/Linux"
VERSION_ID="8"
VERSION="8 (jessie)"
ID=debian
HOME_URL="http://www.debian.org/"
SUPPORT_URL="http://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
Once we know what kind of Linux distribution we're dealing with, we can proceed with looking up for standard location of Apache config:
2. Apache config file location for Fedora / CentOS / RHEL and other RPM based distributions
RHEL / Red Hat / CentOS / Fedora Linux Apache access file location –
/var/log/httpd/access_log
3. Apache config file location for Debian / Ubuntu and other deb based Linux distributions
Debian / Ubuntu Linux Apache access log file location –
/var/log/apache2/access.log
4. Apache config file location for FreeBSD
FreeBSD Apache access log file location –
/var/log/httpd-access.log
5. Finding custom Apache access log locations
If for some reason the system administrator on the remote server changed default path for each of distributions, you can find custom configured log files through:
a) On Debian / Ubuntu / deb distros:
debian:~# grep CustomLog /etc/apache2/apache2.conf
b) On CentOS / RHEL / Fedora Linux RPM based ones:
[root@centos: ~]# grep CustomLog /etc/httpd/conf/httpd.conf
c) On FreeBSD OS
freebsd# grep CustomLog /etc/httpd/conf/httpd.conf
# a CustomLog directive (see below).
#CustomLog "/var/log/httpd-access.log" common
CustomLog "/var/log/httpd-access.log" combined
More helpful Articles
Tags: apache, file, Files, locations, server, WHERE