Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在 /var/log/apache2 中有 4 个文件,我刚刚删除了其中的 2 个(我确实有备份)。它会影响 apache 的日志记录功能吗?如果文件不存在,apache会自动创建文件并写入它们吗?
它将自动创建新文件。
该文件被删除,但文件句柄仍然存在,直到您重新加载/重新启动 apache,至少在 Rhel 7 上。您可以通过sudo lsof | grep access_log在删除 /var/log/httpd/access_log 后运行来验证这一点。您可能会在稍后运行 logrotate 时看到文件自动重新创建,因为这会发出重新加载,然后会触发再次创建文件。
sudo lsof | grep access_log