Log to /var/log/apk.log
This adds a log file at /var/log/apk.log. On each run, apk's version information and the current date & time are written to this file, followed by any normal apk output.
Sample:
[2:07:29] taiga ~/s/apk-tools $ doas cat /var/log/apk.log
Running `apk update` at 2021-02-14 15:00:10
apk-tools 2.12.0-41-g361eb06, compiled for x86_64.
fetch https://mirror.sr.ht/alpine/v3.13/sr.ht/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/edge/testing/x86_64/APKINDEX.tar.gz
main v20210212-119-g45d6e02322 [/home/sircmpwn/packages/main/]
community v3.13.0-1664-g7705c595e2 [/home/sircmpwn/packages/community/]
testing v20201218-547-g62b6f2ff08 [/home/sircmpwn/packages/testing/]
sr.ht [/home/sircmpwn/packages/sr.ht/]
ddevault [/home/sircmpwn/packages/ddevault/]
v20210212-114-g67c8dce31a [http://dl-cdn.alpinelinux.org/alpine/edge/main]
v20210212-113-g8e6bfd3837 [http://dl-cdn.alpinelinux.org/alpine/edge/community]
v20210212-115-g8c3d0fb3da [http://dl-cdn.alpinelinux.org/alpine/edge/testing]
OK: 18767 distinct packages available
Running `apk add stellarium` at 2021-02-14 15:00:38
apk-tools 2.12.0-41-g361eb06, compiled for x86_64.
OK: 10358 MiB in 1406 packages
Running `apk del stellarium` at 2021-02-14 15:00:40
apk-tools 2.12.0-41-g361eb06, compiled for x86_64.
(1/6) Purging gpsd-doc (3.22-r0)
(2/6) Purging stellarium-doc (0.20.4-r2)
(3/6) Purging stellarium (0.20.4-r2)
(4/6) Purging qt5-qtlocation (5.15.2-r1)
(5/6) Purging qt5-qtscript (5.15.2-r1)
(6/6) Purging gpsd (3.22-r0)
Executing busybox-1.33.0-r2.trigger
Executing shared-mime-info-2.1-r0.trigger
Executing gtk-update-icon-cache-2.24.33-r0.trigger
OK: 10023 MiB in 1400 packages