Skip to content

Restore HTTP access logging on the minimal image's :443 vhost (testing) - #156

Merged
jsokol merged 1 commit into
testingfrom
FIX-apache-access-logging-testing
Aug 13, 2026
Merged

Restore HTTP access logging on the minimal image's :443 vhost (testing)#156
jsokol merged 1 commit into
testingfrom
FIX-apache-access-logging-testing

Conversation

@jsokol

@jsokol jsokol commented Aug 13, 2026

Copy link
Copy Markdown
Member

Cherry-pick of #155 onto testing — identical diff, see that PR for the full analysis.

This is the one that reaches demo, which runs release_channel: testing. #155 only affects the release channel.

As with #154, merging triggers Publish simplerisk-minimal testing, which rebuilds 20260811-001-php85 in place (VERSION derives from the bundle name, which hasn't changed). The ECR pull-through cache will keep serving the stale image until purged:

aws ecr batch-delete-image --repository-name docker-hub/simplerisk/simplerisk-minimal \
  --image-ids imageTag=20260811-001-php85 --profile simplerisk-customers-admin
aws ecs update-service --force-new-deployment ...

An Apache CustomLog inside a vhost REPLACES the one inherited from the server
config. default-ssl.conf declared only ssl_request_log, so
conf-enabled/other-vhosts-access-log.conf never applied to :443 -- and since the
ALB speaks only to :443, the :80 vhost's access.log stayed empty too.

The result was no HTTP access logging anywhere for a dedicated-hosting customer.
ssl_request_log was the only record of a request, and it is a poor one: its %h is
the load balancer's private address rather than the caller, and its format carries
no status code, referer, or user agent. Nothing shipped it off the container
either -- it is a real file on the ephemeral /var/log volume, so it died with the
task.

Found while verifying demo's migration: a probe request could not be located in
CloudWatch at all. The log-tailer sidecar appears to cover this (it tails
/var/log/apache2/access.log) but cannot -- that path is a symlink to /dev/stdout
in the php:apache base image, and /dev/stdout is a write end, so the tail reads
nothing. The sidecar entry looked like coverage while providing none.

Adds a combined-format CustomLog to access.log, which reaches the container's
stdout and therefore the awslogs driver. Client identity comes from
X-Forwarded-For, since %h is the load balancer. The whole header is logged
deliberately: the ALB appends the true peer as the last element, so only the last
one is trustworthy, and keeping the chain visible beats hiding a forged prefix
behind a single value.

ssl_request_log is kept for the TLS protocol/cipher detail the combined format
does not carry.

Verified on a built image: `apache2ctl -t` reports Syntax OK, and requests through
the vhost emit, on stdout,

  203.0.113.9  ... "GET /?abuse-probe HTTP/1.1"     200 4031 "-" "curl/8.7.1"
  198.51.100.4 ... "GET /nonexistent-page HTTP/1.1" 404  298 "-" "curl/8.7.1"

including the 404 the previous configuration could not record.
@jsokol
jsokol merged commit f2470a5 into testing Aug 13, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant