简体   繁体   English

AMI上的AWS EC2 apache日志文件位置

[英]AWS EC2 apache log file location on AMI

I'm learning about AWS and EC2. 我正在学习AWS和EC2。 I set up a AMI linux box that is running apache and mysql setup from yum. 我设置了一个AMI linux盒子,它从yum运行apache和mysql设置。 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. 我正在通过一个putty终端移动,我找不到日志文件的位置。 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. 这是新的东西,所以任何有用的文件的位置,以更好地了解正在发生的事情将是有帮助的。

/ var / log目录通常有application和unix日志。

ubuntu under AWS server AWS服务器下的ubuntu

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

linux Linux的

/var/log

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. /var/log/是应用程序日志的通常位置。

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. 如果它受到限制性权限,您可以执行sudo ls /var/log以获取其下的文件和目录列表以查找查询。

Depending on the version of apache, the logs will usually be under either /var/log/apache2 OR /var/log/httpd . 根据apache的版本,日志通常位于/var/log/apache2/var/log/httpd之下。 Again, if you want to look for what specific file you are looking for under this directory, try sudo ls $location$ . 同样,如果您想在此目录下查找您要查找的特定文件,请尝试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. 我的安装在ec2上碰​​巧是在/var/log/httpd/error_log ,但是error.log是另一个常见的文件名。

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 . 然后查看文件的最后100行或X行的快速方法是使用tail -100 /var/log/httpd/error_log

如果你在/var/log找不到它,请尝试/usr/local/apache/logs

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM