怎样才能在泊坞窗集装箱使用Apache并没有什么写入到磁盘(将所有日志STDIO / STDERR)? [英] How does one use Apache in a Docker Container and write nothing to disk (all logs to STDIO / STDERR)?

查看:172
本文介绍了怎样才能在泊坞窗集装箱使用Apache并没有什么写入到磁盘(将所有日志STDIO / STDERR)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在泊坞窗容器中运行的Apache2,想没什么好写​​盘,写日志输出和错误。我见过几个不同的方法来做到这一点(Supervisord和stdout /标准错误,Apache的访问日志到标准输出),但这些似乎是黑客。难道就没有办法在默认情况下做到这一点?

I'm running Apache2 in a docker container and want to write nothing to the disk, writing logs to stdout and stderr. I've seen a few different ways to do this (Supervisord and stdout/stderr, Apache access log to stdout) but these seem like hacks. Is there no way to do this by default?

要清楚,我不想去尾日志,因为这会导致事情被写入到容器内的磁盘。

To be clear, I do not want to tail the log, since that will result in things being written to the disk in the container.

官方版本住进多克尔中心( https://hub.docker.com/_ /的httpd / )仍写入磁盘。

The "official" version checked into Docker Hub (https://hub.docker.com/_/httpd/) still write to disk.

此外,什么做我需要做的,从没有停止Apache的时候,它会滚动日志?

Also, what do I need to do to stop Apache from failing when it tries to roll the logs?

还有一件事 - 理想情况下,我真的很想这样做没有其他附加。 nginx的可以做到这一点平凡。

One other thing - ideally, I'd really like to do this without another add-on. nginx can do this trivially.

推荐答案

据Apache的邮件列表,你可以直接写入到/ dev /标准输入输出(在Unix类系统),因为这只是一个普通的醇'文件句柄。简单!粘贴...

According to the apache mailing list, you can just directly write to /dev/stdio (on Unix like systems) as that's just a regular ol' file handle. Easy! Pasting...

最有效的答案取决于你的操作系统。如果你是
  在类UNIX系统提供的/ dev /标准输出和/ dev /标准错误(或
  也许是的/ dev / FD / 1和/ dev / FD / 2),然后使用这些文件的名称。如果说
  是不是一种选择使​​用传送输出功能。例如,来自我的
  配置:

The most efficient answer depends on your operating system. If you're on a UNIX like system which provides /dev/stdout and /dev/stderr (or perhaps /dev/fd/1 and /dev/fd/2) then use those file names. If that isn't an option use the piped output feature. For example, from my config:

的CustomLog| / usr / sbin目录/ rotatelogs -c -f -l -L
  /private/var/log/apache2/test-access.log
  /private/var/log/apache2/test-access.log.%Y-%m-%d 86400
  krader_custom错误日志| / usr / sbin目录/ rotatelogs -c -f -l -L
  /private/var/log/apache2/test-error.log
  /private/var/log/apache2/test-error.log.%Y-%m-%d 86400

CustomLog "|/usr/sbin/rotatelogs -c -f -l -L /private/var/log/apache2/test-access.log /private/var/log/apache2/test-access.log.%Y-%m-%d 86400 " krader_custom ErrorLog "|/usr/sbin/rotatelogs -c -f -l -L /private/var/log/apache2/test-error.log /private/var/log/apache2/test-error.log.%Y-%m-%d 86400"

显然,你会想换另一个程序
  在上面的例子/ usr / sbin目录/ rotatelogs写入数据的地方
  你想让它去的。

Obviously you'll want to substitute another program for /usr/sbin/rotatelogs in the example above that writes the data where you want it to go.

<一个href=\"https://mail-archives.apache.org/mod_mbox/httpd-users/201508.mbox/%3CCABx2=D-wdd8FYLkHMqiNOKmOaNYb-tAOB-AsSEf2p=ctd6sMdg@mail.gmail.com%3E\" rel=\"nofollow\">https://mail-archives.apache.org/mod_mbox/httpd-users/201508.mbox/%3CCABx2=D-wdd8FYLkHMqiNOKmOaNYb-tAOB-AsSEf2p=ctd6sMdg@mail.gmail.com%3E

这篇关于怎样才能在泊坞窗集装箱使用Apache并没有什么写入到磁盘(将所有日志STDIO / STDERR)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆