我使用的是亚马逊网络服务AutoScaling组。我在这里托管了Apche-Ubuntu实例。我想通过记录其ip来记录提供内容的服务器。
我找到的最接近的评论是这条https://ubuntuforums.org/archive/index.php/t-1401710.html (2010年2月11日下午04:07 )。
发布于 2020-05-04 19:56:54
在Apache中,您可以使用指令LogFormat,它允许您确定每个日志的标头中包含哪些信息。在apache2.conf中创建LogFormat字符串,然后在使用CustomLog指令时使用这些字符串。
Apache帮助中使用的示例:
LogFormat "%h %l %u %t \"%r\" %>s %b" common
CustomLog "logs/access_log" common这意味着access_log中的日志将包含以下信息:
在log formats documentation中有一个%A - Local IP-address
我从未测试过它,但它也许能满足您的需求。
https://stackoverflow.com/questions/61589619
复制相似问题