Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions ci/image-tests/Checks/ContainerEnvironmentChecks.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,31 @@ public function testSyslogMessagesReachTheFileFromTheEnvironment(): void
});
}

/**
* Without LOG_STDOUT, in the container of the class, /docker.stdout is the stdout of the container, a pipe of the
* container runtime like /docker.stderr. syslog-ng writes to it but keeps its owner and mode: on gVisor before
* release-20261005.0, as on DigitalOcean App Platform, fchmod() on it drops its file type, and no service can open
* it afterwards (google/gvisor@3cf8bfde6). Only in the images that start syslog-ng.
*/
public function testSyslogKeepsTheOwnerAndModeOfTheContainerStdout(): void
{
if (!in_array('syslog', self::services(), true)) {
self::markTestSkipped('The image does not start syslog-ng.');
}

$container = self::container();
// once its message is in the container log, syslog-ng has opened /docker.stdout
$this->eventually(function () use ($container): void {
$this->assertCommandSucceeds('logger -t image-test stdout-marker', $container);
self::assertStringContainsString('image-test: stdout-marker', $container->logStreams()[0]);
});
self::assertSame(
$this->stdout("stat -L -c '%f %U:%G' /docker.stderr", $container),
$this->stdout("stat -L -c '%f %U:%G' /docker.stdout", $container),
'The stdout of the container should keep the type, mode and owner that it has like its stderr.',
);
}

/**
* /docker.stdout and /docker.stderr, where the services of the image write their logs, point to the files of
* LOG_STDOUT and LOG_STDERR.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ if [ ! -S /var/lib/syslog-ng/syslog-ng.ctl ]; then rm -f /var/lib/syslog-ng/sysl

if [[ ! -p /docker.stdout ]]; then
# Switch to file (tty docker mode)
go-replace -s 'pipe("/docker.stdout")' -r 'file("/docker.stdout")' -- /opt/docker/etc/syslog-ng/syslog-ng.conf
go-replace -s 'pipe("/docker.stdout"' -r 'file("/docker.stdout"' -- /opt/docker/etc/syslog-ng/syslog-ng.conf
fi
2 changes: 1 addition & 1 deletion docker/php/8.2-alpine/conf/etc/syslog-ng/syslog-ng.conf
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ filter f_filter {

destination d_all {
# syslog-d_all START
pipe("/docker.stdout");
pipe("/docker.stdout" owner() group() perm());
# syslog-d_all END
};

Expand Down
2 changes: 1 addition & 1 deletion docker/php/8.2/conf/bin/service.d/syslog-ng.d/10-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ if [ ! -S /var/lib/syslog-ng/syslog-ng.ctl ]; then rm -f /var/lib/syslog-ng/sysl

if [[ ! -p /docker.stdout ]]; then
# Switch to file (tty docker mode)
go-replace -s 'pipe("/docker.stdout")' -r 'file("/docker.stdout")' -- /opt/docker/etc/syslog-ng/syslog-ng.conf
go-replace -s 'pipe("/docker.stdout"' -r 'file("/docker.stdout"' -- /opt/docker/etc/syslog-ng/syslog-ng.conf
fi
2 changes: 1 addition & 1 deletion docker/php/8.2/conf/etc/syslog-ng/syslog-ng.conf
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ filter f_filter {

destination d_all {
# syslog-d_all START
pipe("/docker.stdout");
pipe("/docker.stdout" owner() group() perm());
# syslog-d_all END
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ if [ ! -S /var/lib/syslog-ng/syslog-ng.ctl ]; then rm -f /var/lib/syslog-ng/sysl

if [[ ! -p /docker.stdout ]]; then
# Switch to file (tty docker mode)
go-replace -s 'pipe("/docker.stdout")' -r 'file("/docker.stdout")' -- /opt/docker/etc/syslog-ng/syslog-ng.conf
go-replace -s 'pipe("/docker.stdout"' -r 'file("/docker.stdout"' -- /opt/docker/etc/syslog-ng/syslog-ng.conf
fi
2 changes: 1 addition & 1 deletion docker/php/8.3-alpine/conf/etc/syslog-ng/syslog-ng.conf
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ filter f_filter {

destination d_all {
# syslog-d_all START
pipe("/docker.stdout");
pipe("/docker.stdout" owner() group() perm());
# syslog-d_all END
};

Expand Down
2 changes: 1 addition & 1 deletion docker/php/8.3/conf/bin/service.d/syslog-ng.d/10-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ if [ ! -S /var/lib/syslog-ng/syslog-ng.ctl ]; then rm -f /var/lib/syslog-ng/sysl

if [[ ! -p /docker.stdout ]]; then
# Switch to file (tty docker mode)
go-replace -s 'pipe("/docker.stdout")' -r 'file("/docker.stdout")' -- /opt/docker/etc/syslog-ng/syslog-ng.conf
go-replace -s 'pipe("/docker.stdout"' -r 'file("/docker.stdout"' -- /opt/docker/etc/syslog-ng/syslog-ng.conf
fi
2 changes: 1 addition & 1 deletion docker/php/8.3/conf/etc/syslog-ng/syslog-ng.conf
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ filter f_filter {

destination d_all {
# syslog-d_all START
pipe("/docker.stdout");
pipe("/docker.stdout" owner() group() perm());
# syslog-d_all END
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ if [ ! -S /var/lib/syslog-ng/syslog-ng.ctl ]; then rm -f /var/lib/syslog-ng/sysl

if [[ ! -p /docker.stdout ]]; then
# Switch to file (tty docker mode)
go-replace -s 'pipe("/docker.stdout")' -r 'file("/docker.stdout")' -- /opt/docker/etc/syslog-ng/syslog-ng.conf
go-replace -s 'pipe("/docker.stdout"' -r 'file("/docker.stdout"' -- /opt/docker/etc/syslog-ng/syslog-ng.conf
fi
2 changes: 1 addition & 1 deletion docker/php/8.4-alpine/conf/etc/syslog-ng/syslog-ng.conf
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ filter f_filter {

destination d_all {
# syslog-d_all START
pipe("/docker.stdout");
pipe("/docker.stdout" owner() group() perm());
# syslog-d_all END
};

Expand Down
2 changes: 1 addition & 1 deletion docker/php/8.4/conf/bin/service.d/syslog-ng.d/10-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ if [ ! -S /var/lib/syslog-ng/syslog-ng.ctl ]; then rm -f /var/lib/syslog-ng/sysl

if [[ ! -p /docker.stdout ]]; then
# Switch to file (tty docker mode)
go-replace -s 'pipe("/docker.stdout")' -r 'file("/docker.stdout")' -- /opt/docker/etc/syslog-ng/syslog-ng.conf
go-replace -s 'pipe("/docker.stdout"' -r 'file("/docker.stdout"' -- /opt/docker/etc/syslog-ng/syslog-ng.conf
fi
2 changes: 1 addition & 1 deletion docker/php/8.4/conf/etc/syslog-ng/syslog-ng.conf
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ filter f_filter {

destination d_all {
# syslog-d_all START
pipe("/docker.stdout");
pipe("/docker.stdout" owner() group() perm());
# syslog-d_all END
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ if [ ! -S /var/lib/syslog-ng/syslog-ng.ctl ]; then rm -f /var/lib/syslog-ng/sysl

if [[ ! -p /docker.stdout ]]; then
# Switch to file (tty docker mode)
go-replace -s 'pipe("/docker.stdout")' -r 'file("/docker.stdout")' -- /opt/docker/etc/syslog-ng/syslog-ng.conf
go-replace -s 'pipe("/docker.stdout"' -r 'file("/docker.stdout"' -- /opt/docker/etc/syslog-ng/syslog-ng.conf
fi
2 changes: 1 addition & 1 deletion docker/php/8.5-alpine/conf/etc/syslog-ng/syslog-ng.conf
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ filter f_filter {

destination d_all {
# syslog-d_all START
pipe("/docker.stdout");
pipe("/docker.stdout" owner() group() perm());
# syslog-d_all END
};

Expand Down
2 changes: 1 addition & 1 deletion docker/php/8.5/conf/bin/service.d/syslog-ng.d/10-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ if [ ! -S /var/lib/syslog-ng/syslog-ng.ctl ]; then rm -f /var/lib/syslog-ng/sysl

if [[ ! -p /docker.stdout ]]; then
# Switch to file (tty docker mode)
go-replace -s 'pipe("/docker.stdout")' -r 'file("/docker.stdout")' -- /opt/docker/etc/syslog-ng/syslog-ng.conf
go-replace -s 'pipe("/docker.stdout"' -r 'file("/docker.stdout"' -- /opt/docker/etc/syslog-ng/syslog-ng.conf
fi
2 changes: 1 addition & 1 deletion docker/php/8.5/conf/etc/syslog-ng/syslog-ng.conf
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ filter f_filter {

destination d_all {
# syslog-d_all START
pipe("/docker.stdout");
pipe("/docker.stdout" owner() group() perm());
# syslog-d_all END
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ if [ ! -S /var/lib/syslog-ng/syslog-ng.ctl ]; then rm -f /var/lib/syslog-ng/sysl

if [[ ! -p /docker.stdout ]]; then
# Switch to file (tty docker mode)
go-replace -s 'pipe("/docker.stdout")' -r 'file("/docker.stdout")' -- /opt/docker/etc/syslog-ng/syslog-ng.conf
go-replace -s 'pipe("/docker.stdout"' -r 'file("/docker.stdout"' -- /opt/docker/etc/syslog-ng/syslog-ng.conf
fi
2 changes: 1 addition & 1 deletion docker/php/8.6-alpine/conf/etc/syslog-ng/syslog-ng.conf
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ filter f_filter {

destination d_all {
# syslog-d_all START
pipe("/docker.stdout");
pipe("/docker.stdout" owner() group() perm());
# syslog-d_all END
};

Expand Down
2 changes: 1 addition & 1 deletion docker/php/8.6/conf/bin/service.d/syslog-ng.d/10-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ if [ ! -S /var/lib/syslog-ng/syslog-ng.ctl ]; then rm -f /var/lib/syslog-ng/sysl

if [[ ! -p /docker.stdout ]]; then
# Switch to file (tty docker mode)
go-replace -s 'pipe("/docker.stdout")' -r 'file("/docker.stdout")' -- /opt/docker/etc/syslog-ng/syslog-ng.conf
go-replace -s 'pipe("/docker.stdout"' -r 'file("/docker.stdout"' -- /opt/docker/etc/syslog-ng/syslog-ng.conf
fi
2 changes: 1 addition & 1 deletion docker/php/8.6/conf/etc/syslog-ng/syslog-ng.conf
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ filter f_filter {

destination d_all {
# syslog-d_all START
pipe("/docker.stdout");
pipe("/docker.stdout" owner() group() perm());
# syslog-d_all END
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ if [ ! -S /var/lib/syslog-ng/syslog-ng.ctl ]; then rm -f /var/lib/syslog-ng/sysl

if [[ ! -p /docker.stdout ]]; then
# Switch to file (tty docker mode)
go-replace -s 'pipe("/docker.stdout")' -r 'file("/docker.stdout")' -- /opt/docker/etc/syslog-ng/syslog-ng.conf
go-replace -s 'pipe("/docker.stdout"' -r 'file("/docker.stdout"' -- /opt/docker/etc/syslog-ng/syslog-ng.conf
fi
2 changes: 1 addition & 1 deletion provisioning/base/general/etc/syslog-ng/syslog-ng.conf
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ filter f_filter {

destination d_all {
# syslog-d_all START
pipe("/docker.stdout");
pipe("/docker.stdout" owner() group() perm());
# syslog-d_all END
};

Expand Down