AWS EC2 apache log file location on AMI

19,634

Solution 1

/var/log directory usually has application and unix logs.

Solution 2

ubuntu under AWS server

sudo tail -100 /var/log/apache2/error.log

linux

/var/log

Solution 3

A more general purpose way of finding the log, since a specific file will often be in a different place depending on the installation and version, as I found mine differed from the previous answers:

/var/log/ is the usual location for application logs.

If it is under restrictive permissions, you can do sudo ls /var/log to get a list of files and directories under it to hunt down your query.

Depending on the version of apache, the logs will usually be under either /var/log/apache2 OR /var/log/httpd. Again, if you want to look for what specific file you are looking for under this directory, try sudo ls $location$.

Mine happened to be under /var/log/httpd/error_log from my installation on ec2, but error.log is another common file name.

Older error logs, and the corresponding access logs, are also saved here after they are rotated out, with the timestamp of when the rotation occurred.

The quick way to then view the last 100 or X lines of the file is to use tail -100 /var/log/httpd/error_log.

Share:
19,634

Related videos on Youtube

usumoio
Author by

usumoio

Sometimes I wear tee-shirts, ... Sometimes. http://usumoio.com/

Updated on June 21, 2022

Comments

  • usumoio
    usumoio almost 2 years

    I'm learning about AWS and EC2. I set up a AMI linux box that is running apache and mysql setup from yum. It was working for a bit, but now its flatlined. This is strange, so I thought to go check the logs. I'm moving around via a putty terminal and I cannot find the log files location. Does anyone know there that information is stored. Thanks you for the help.

    Edit: I would like to generalize and ask about the location of any important log files that the system creates. This is new stuff to be, so the location of any useful files to better understand what is going on would be helpful.

  • usumoio
    usumoio almost 11 years
    Yup, I cracked this one not too long after I asked it. I'm been busy so I never got around to updating this.