Skip to content
Compliance engineering: CRA and AI Act on Kubernetes · Chapter 12 of 20 Day 11: The tachograph – logs, retention, data protection

Day 11: The tachograph – logs, retention, data protection

Goal: give the Lotse an event log under Article 12 AI Act that works without names, keep it for at least six months and delete it automatically afterwards, and build in an access log that can be switched off for the CRA gap in point 2(l) · Duration: about 110 min · Prerequisite: Day 10 completed

State before this chapter

# on werk1
helm list -n lotse

Expected:

NAME    NAMESPACE   REVISION    UPDATED                                 STATUS      CHART                   APP VERSION
lotse   lotse       13          2026-12-04 07:56:18.275442906 +0000 UTC deployed    bewerbungslotse-1.0.3   1.0.2
# on werk1
git -C ~/lotse log --oneline --decorate -1

Expected:

ba3cbb8 (HEAD -> main) 1.1.0-rc1: KI-Ausgaben gekennzeichnet (Art. 50 AI Act), Einstufung als Hochrisiko-KI-System

Since Day 10, the pre-release 1.1.0-rc1 has been running, although helm list still shows 1.0.2. Today you bring the two back into line.

Introduction

An applicant calls: “Your system sorted me out. When was that, with which version, and who has looked at my application file since then?” Today you can’t answer any of these questions. The Lotse assesses, stores an application file and forgets the rest.

For a high-risk AI system, that is too little. Article 12 AI Act requires that the system technically allows for “the automatic recording of events (logs)”, and Article 19 and Article 26(6) that these logs are kept for at least six months. At the same time, every line about an applicant is personal data, and the GDPR requires storing as little as possible and for no longer than necessary. And the CRA left you an open gap on Day 9: point (l), “recording and monitoring” with an opt-out.

Today you build the tachograph: a log that records enough to trace every assessment, and so little that it exposes nobody.

Today you will learn:

  • to measure what a service records today, and to derive from that what is missing,
  • to write a structured event log (JSON Lines) that links via the application file number instead of names,
  • to put logs on a volume so that they survive a restart,
  • to enforce the retention period with a CronJob and to check it with practice files,
  • to make an access log switchable via a chart value and to measure the switching off.

Background

The picture of the day: the tachograph in the lorry

Every lorry in the factory’s transport fleet has a tachograph. It records when the lorry was driven, how fast and for how long, and it does so automatically. The driver cannot switch it off. But it doesn’t record what the driver talked about on the phone: it stores what is needed for inspection, nothing more.

The data doesn’t stay on the display. It ends up on the driver card and in the memory, because an inspection weeks later still needs it. And it doesn’t stay forever: after the prescribed period, it is deleted.

In addition, the factory gate has a visitor list. It notes who came in when. That is practical for security, but not mandatory, and a business that prefers to use a camera can switch it off.

  • Tachograph = event log (Article 12 AI Act): automatic, cannot be switched off, only what is needed.
  • Driver card = file on the volume: survives the restart.
  • Display = kubectl logs: shows only the current container.
  • Deletion deadline = CronJob (Article 19 and Article 26(6) AI Act: at least six months).
  • Visitor list at the gate = gunicorn’s access log (Annex I, Part I, point 2(l) CRA): with opt-out.

The terms

Term Meaning In the picture
record-keeping (logging) automatic recording of events during operation (Article 12(1)) tachograph
event an action that matters for traceability, here: assessment, application file read, export a trip
JSON Lines file with exactly one JSON object per line; easy to append, evaluate with jq strip in the recorder
pseudonym identifier that only points to a person with a second source, here the application file number number plate instead of driver’s name
retention period how long logs stay at least (six months) and when they must go deletion deadline
access log one line per HTTP request: address, time, path, status visitor list
opt-out option for users to switch off a recording switch off the visitor list

Remember: A log is like a tachograph: it automatically records what the inspection needs, keeps it long enough and stores nothing beyond that.

What the law requires

Article 12(2) AI Act: Logging capabilities shall enable the recording of events relevant for “(a) identifying situations that may result in the high-risk AI system presenting a risk […] or in a substantial modification; (b) facilitating the post-market monitoring referred to in Article 72; and (c) monitoring the operation of high-risk AI systems referred to in Article 26(5).” Article 12(3) prescribes specific fields only for biometric systems. For the Lotse, you decide yourself what is “relevant”, and you justify it.

Article 19(1) (providers) and Article 26(6) (deployers): logs, “to the extent such logs are under their control”, are kept “for a period appropriate to the intended purpose of the high-risk AI system, of at least six months”, unless provided otherwise in other law, “in particular in Union law on the protection of personal data” (Article 26(6)).

Article 5(1) GDPR: data minimisation (point (c), only what is necessary for the purpose) and storage limitation (point (e), no longer than necessary). Together with Article 19, this gives a lower limit of six months and an upper limit that you have to justify.

Annex I, Part I, point 2(l) CRA: products shall “provide security related information by recording and monitoring relevant internal activity, including the access to or modification of data, services or functions, with an opt-out mechanism for the user”.

So the two laws pull in different directions: the AI Act’s event log must stay, the recording under the CRA needs a switch. You therefore build two separate logs.

This course is not legal advice. Which period is appropriate for your organisation, you set in real operation with the data protection officer. The 210 days in this chapter are a justified example, not a recommendation.

Drill 1: What does the Lotse record today?

Where you are: on werk1.

What you have afterwards: a measured finding of which questions the Lotse cannot answer today.

Step 1 – read the Lotse’s log. After the upgrade to 1.1.0-rc1 on Day 10, you sent an application and exported all application files. What of that is in the log?

# on werk1
kubectl -n lotse logs deploy/lotse

Expected:

[2026-12-04 07:56:21 +0000] [1] [INFO] Starting gunicorn 22.0.0
[2026-12-04 07:56:21 +0000] [1] [INFO] Listening at: http://0.0.0.0:8080 (1)
[2026-12-04 07:56:21 +0000] [1] [INFO] Using worker: sync
[2026-12-04 07:56:22 +0000] [7] [INFO] Booting worker with pid: 7

What you see: Four start lines from gunicorn, nothing else. No assessment, no export. On Day 8 you had switched on the access log with kubectl set env only temporarily for the customer.

Step 2 – look at the storage.

# on werk1
kubectl -n lotse exec deploy/lotse -- ls -l /daten

Expected:

total 20
-rw-r--r-- 1 10001 10001  336 Dec  3 12:12 270969b6.json
-rw-r--r-- 1 10001 10001  320 Dec  4 07:36 7aeb966e.json
drwxr-sr-x 3 10001 10001 4096 Dec  3 14:34 anlagen
-rw-r--r-- 1 10001 10001  320 Dec  3 12:13 b0ef4bd7.json
-rw-r--r-- 1 10001 10001  488 Dec  4 07:56 ff85a953.json

Step 3 – read the newest application file.

# on werk1
kubectl -n lotse exec deploy/lotse -- cat /daten/ff85a953.json

Expected:

{"nummer": "ff85a953", "name": "Mara Klein", "stelle": "Linux-Administratorin (m/w/d) mit Kubernetes-Erfahrung", "bewertung": {"passung": 5, "begruendung": "Die Bewerbung zeigt klare, relevante Erfahrung in Linux-Administration und Kubernetes mit konkreten Tools wie k3s, RKE2, Ansible und Helm-Charts, was die Stelle sehr gut passt."}, "ki": {"erzeugt": true, "system": "Bewerbungslotse 1.1.0-rc1", "modell": "qwen3:4b-instruct", "art": "Vorschlag eines KI-Systems, keine Entscheidung"}}

What you see: Since Day 10, the application file says which system assessed it. It doesn’t answer the rest of the caller’s questions:

Question Answer today
When was it assessed? only the file’s modification date, and that changes when somebody touches the application file
How long did it take? nowhere
Who read the application file? nowhere
Who exported all application files, who tried in vain? nowhere

Remember: Before you build a log, ask the questions it is supposed to answer. What you cannot answer today is your list of requirements.

Save your progress? Sign up for free

Drill 2: Building in the tachograph

Where you are: on werk1.

What you have afterwards: version 1.1.0-rc2 with an event log, chart 1.1.0-rc.2 with an access log that can be switched off and a deletion CronJob, in your own operation as revision 14.

Four events answer the questions from Drill 1: bewertung, akte_gelesen, export and export_abgelehnt. Every line gets the time, the event and the system version. The assessment additionally gets the application file number, model, duration and score. No name, no application text, no justification. Whoever wants to know who is behind e35b8423 needs the application file, and that is protected.

Step 1 – create a folder for today.

# on werk1
mkdir -p ~/kurs/11

Step 2 – build the event log into app.py.

# on werk1
nano ~/lotse/app.py
~/lotse/app.py changes in green
"""Bewerbungslotse – sortiert Bewerbungen mit einem Sprachmodell vor."""

import hmac
import json
import os
import time
import uuid
from datetime import datetime, timezone
from pathlib import Path

import requests
from flask import Flask, abort, jsonify, request, send_file, send_from_directory

VERSION = "1.1.0-rc2"
OLLAMA = os.environ.get("OLLAMA_URL", "http://ollama:11434")
MODELL = os.environ.get("MODELL", "qwen3:4b-instruct")
ABLAGE = Path(os.environ.get("ABLAGE", "/daten"))
PROTOKOLL = ABLAGE / "protokoll"
# strip(): eine Passwortdatei endet meist mit einem Zeilenumbruch
ADMIN_PASSWORT = os.environ.get("ADMIN_PASSWORT", "").strip()

ANWEISUNG = (
    "Du hilfst einer Personalabteilung. Bewerte, wie gut die Bewerbung zur Stelle passt. "
    'Antworte nur mit JSON: {"passung": <Zahl von 1 bis 5>, "begruendung": "<ein Satz>"}'
)

# Kennzeichnung: Bewertung und Begründung stammen von einem KI-System (Art. 50, Art. 26 Abs. 11 AI Act)
KI_HINWEIS = {
    "erzeugt": True,
    "system": f"Bewerbungslotse {VERSION}",
    "modell": MODELL,
    "art": "Vorschlag eines KI-Systems, keine Entscheidung",
}

app = Flask(__name__)


def ereignis(art, **felder):
    """Fahrtenschreiber (Art. 12 AI Act): eine JSON-Zeile je Ereignis, ohne Namen und Texte."""
    jetzt = datetime.now(timezone.utc)
    zeile = {
        "zeit": jetzt.isoformat(timespec="seconds"),
        "ereignis": art,
        "system": f"Bewerbungslotse {VERSION}",
        **felder,
    }
    text = json.dumps(zeile, ensure_ascii=False)
    print(text, flush=True)
    PROTOKOLL.mkdir(exist_ok=True)
    with open(PROTOKOLL / f"ereignisse-{jetzt:%Y-%m}.jsonl", "a") as datei:
        datei.write(text + "\n")


@app.get("/.well-known/security.txt")
def security_txt():
    # Anlaufstelle für Sicherheitsmeldungen (RFC 9116)
    return send_file(Path(__file__).with_name("security.txt"), mimetype="text/plain")


@app.get("/gesund")
def gesund():
    return {"status": "ok", "version": VERSION}


@app.post("/api/bewerbungen")
def bewerbung_anlegen():
    daten = request.get_json(force=True)
    frage = f"Stelle: {daten['stelle']}\n\nBewerbung:\n{daten['text']}"
    beginn = time.monotonic()
    antwort = requests.post(
        f"{OLLAMA}/api/chat",
        json={
            "model": MODELL,
            "stream": False,
            "format": "json",
            "options": {"temperature": 0},
            "messages": [
                {"role": "system", "content": ANWEISUNG},
                {"role": "user", "content": frage},
            ],
        },
        timeout=300,
    )
    antwort.raise_for_status()
    bewertung = json.loads(antwort.json()["message"]["content"])
    akte = {
        "nummer": uuid.uuid4().hex[:8],
        "name": daten["name"],
        "stelle": daten["stelle"],
        "bewertung": bewertung,
        "ki": KI_HINWEIS,
    }
    (ABLAGE / f"{akte['nummer']}.json").write_text(json.dumps(akte, ensure_ascii=False))
    ereignis(
        "bewertung",
        akte=akte["nummer"],
        modell=MODELL,
        dauer_ms=round((time.monotonic() - beginn) * 1000),
        passung=bewertung.get("passung"),
    )
    return jsonify(akte), 201


@app.get("/api/bewerbungen/<nummer>")
def bewerbung_lesen(nummer):
    akte = ABLAGE / f"{nummer}.json"
    if not nummer.isalnum() or not akte.exists():
        abort(404)
    ereignis("akte_gelesen", akte=nummer)
    return json.loads(akte.read_text())


@app.post("/api/bewerbungen/<nummer>/anlagen")
def anlage_hochladen(nummer):
    # nur zu einer vorhandenen Bewerbung, nie ".." (BW-2026-002)
    if not nummer.isalnum() or not (ABLAGE / f"{nummer}.json").exists():
        abort(404)
    datei = request.files["datei"]
    ordner = ABLAGE / "anlagen" / nummer
    ordner.mkdir(parents=True, exist_ok=True)
    datei.save(ordner / Path(datei.filename).name)
    return {"gespeichert": f"{nummer}/{Path(datei.filename).name}"}, 201


@app.get("/api/anlagen/<path:name>")
def anlage_herunterladen(name):
    # send_from_directory bleibt im Ordner, sonst 404 (BW-2026-001)
    return send_from_directory(ABLAGE / "anlagen", name)


@app.get("/api/admin/export")
def export():
    if not ADMIN_PASSWORT:
        abort(404)
    zugang = request.authorization
    if zugang is None or not hmac.compare_digest(zugang.password or "", ADMIN_PASSWORT):
        ereignis("export_abgelehnt")
        abort(401)
    akten = [json.loads(p.read_text()) for p in sorted(ABLAGE.glob("*.json"))]
    ereignis("export", anzahl=len(akten))
    return akten
Line Change Why
6, 8 time, datetime measure duration, time in UTC
14 1.1.0-rc2 second pre-release
18 PROTOKOLL folder on the volume, not in the container
38–51 ereignis() builds a JSON line, writes it to the log and appends it to the monthly file
42 timespec="seconds" seconds are enough; milliseconds would only suggest false precision
48 print(…, flush=True) straight into the container log, not only when the buffer is full
50 "a" append, never overwrite
69 beginn = time.monotonic() a clock that doesn’t jump when somebody sets the system time
94–100 event bewertung application file, model, duration, score, but no name
109 event akte_gelesen who retrieved which application file when
137 event export_abgelehnt wrong password: security-relevant
139–141 event export how many application files leave the organisation at once

The Lotse runs with exactly one gunicorn worker. So there are no two writers appending to the same file at the same time. If you switch on several workers in a later chapter, this spot comes back on the table.

Step 3 – check the change.

# on werk1
git -C ~/lotse diff --stat

Expected:

 app.py | 35 +++++++++++++++++++++++++++++++++--
 1 file changed, 33 insertions(+), 2 deletions(-)

Step 4 – change into the repository.

# on werk1
cd ~/lotse

Step 5 – build the pre-release. This time with --pull=always, so that the base image is fresh.

# on werk1
podman build --pull=always -t werk1:5000/bewerbungslotse:1.1.0-rc2 .

Expected (excerpt from the end):

[2/2] STEP 5/10: COPY --from=bau /app/pakete /app/pakete
--> Using cache ea462e625d90abe56baf8fc29a9a3b3418d739b87b6443b8356b25628559a7a1
--> ea462e625d90
[2/2] STEP 6/10: COPY app.py security.txt ./
--> 3334fea20449
[2/2] STEP 7/10: ENV PYTHONPATH=/app/pakete
--> 570da3035914
[2/2] STEP 8/10: USER 10001:10001
--> 494dcbfe5006
[2/2] STEP 9/10: EXPOSE 8080
--> 4f41fdb806f0
[2/2] STEP 10/10: CMD ["python", "-m", "gunicorn", "--bind", "0.0.0.0:8080", "--timeout", "300", "--worker-tmp-dir", "/tmp", "app:app"]
[2/2] COMMIT werk1:5000/bewerbungslotse:1.1.0-rc2
--> ae3a61836632
Successfully tagged werk1:5000/bewerbungslotse:1.1.0-rc2
ae3a61836632ca0951db08b042ae87fee479e8b97112336c2cfd186bd7fb2294

What you see: Podman requested python:3.12-slim again (Trying to pull), but used the cache afterwards anyway. The base image hasn’t changed since yesterday; the layers are the same.

Step 6 – push and record the digest.

# on werk1
podman push --digestfile ~/kurs/11/digest-1.1.0-rc2 werk1:5000/bewerbungslotse:1.1.0-rc2
  • --digestfile <file>: write the digest of the uploaded manifest to a file.
# on werk1
cat ~/kurs/11/digest-1.1.0-rc2

Expected (your digest differs):

sha256:a9599edbe84b18dd2f02a060c484ef95e777bd16779a6c32e9e0072b1cb72b50

Step 7 – raise the chart version and the app version. The lesson from Day 10’s diagnosis: image, VERSION and appVersion go up together. For the chart you use the SemVer notation 1.1.0-rc.2: with the dot, Helm compares the 2 as a number, so rc.10 comes after rc.9 and not before it.

# on werk1
nano ~/lotse/chart/Chart.yaml
~/lotse/chart/Chart.yaml changes in green
apiVersion: v2
name: bewerbungslotse
description: Sortiert Bewerbungen mit einem Sprachmodell vor
type: application
version: 1.1.0-rc.2
appVersion: "1.1.0-rc2"

Step 8 – add the values. Image with digest, plus the block protokoll.

# on werk1
nano ~/lotse/chart/values.yaml
~/lotse/chart/values.yaml changes in green
lotse:
  # Tag zum Lesen, Digest zum Laden: genau das gebaute Image
  image: werk1:5000/bewerbungslotse:1.1.0-rc2@sha256:a9599edbe84b18dd2f02a060c484ef95e777bd16779a6c32e9e0072b1cb72b50
  # Pflichtwert, kein Standardpasswort: --set lotse.adminPasswort=…
  adminPasswort: ""
  service:
    # ClusterIP: nur im Cluster erreichbar; NodePort nur bewusst setzen
    typ: ClusterIP
    nodePort: 30080
  speicher: 1Gi
  protokoll:
    # Zugriffsprotokoll von gunicorn (CRA Anhang I Teil I Nr. 2 Buchst. l); false schaltet es ab
    zugriffe: true
    # Ereignisdateien mindestens sechs Monate aufbewahren (Art. 19 und Art. 26 Abs. 6 AI Act)
    aufbewahrungTage: 210

ollama:
  image: docker.io/ollama/ollama:0.40.19
  modell: qwen3:4b-instruct
  knoten: werk1
  speicher: 10Gi

# NetworkPolicies: nur der Lotse darf Ollama erreichen
netzwerkregeln: true
Line Value Meaning
3 …:1.1.0-rc2@sha256:a959… insert your digest from step 6
13 zugriffe: true access log on; the deployer can switch it off
15 aufbewahrungTage: 210 six months minimum period plus one month buffer, because a monthly file only gets its last line at the end of the month

Step 9 – hang the access log on the switch. gunicorn reads additional options from the environment variable GUNICORN_CMD_ARGS. --access-logfile - writes one line per request to standard output.

# on werk1
nano ~/lotse/chart/templates/lotse.yaml
~/lotse/chart/templates/lotse.yaml changes in green
apiVersion: v1
kind: Secret
metadata:
  name: lotse-admin
type: Opaque
stringData:
  passwort: {{ required "lotse.adminPasswort fehlt – es gibt kein Standardpasswort" .Values.lotse.adminPasswort | quote }}
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: lotse-daten
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: {{ .Values.lotse.speicher }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: lotse
spec:
  replicas: 1
  selector:
    matchLabels:
      app: lotse
  template:
    metadata:
      labels:
        app: lotse
    spec:
      automountServiceAccountToken: false
      securityContext:
        runAsNonRoot: true
        runAsUser: 10001
        runAsGroup: 10001
        fsGroup: 10001
        seccompProfile:
          type: RuntimeDefault
      containers:
        - name: lotse
          image: {{ .Values.lotse.image }}
          ports:
            - containerPort: 8080
          env:
            - name: OLLAMA_URL
              value: http://ollama:11434
            - name: MODELL
              value: {{ .Values.ollama.modell }}
            - name: ADMIN_PASSWORT
              valueFrom:
                secretKeyRef:
                  name: lotse-admin
                  key: passwort
            {{- if .Values.lotse.protokoll.zugriffe }}
            - name: GUNICORN_CMD_ARGS
              value: "--access-logfile -"
            {{- end }}
          securityContext:
            allowPrivilegeEscalation: false
            readOnlyRootFilesystem: true
            capabilities:
              drop:
                - ALL
          resources:
            requests:
              cpu: 100m
              memory: 128Mi
            limits:
              cpu: "1"
              memory: 512Mi
          readinessProbe:
            httpGet:
              path: /gesund
              port: 8080
          volumeMounts:
            - name: daten
              mountPath: /daten
            - name: tmp
              mountPath: /tmp
      volumes:
        - name: daten
          persistentVolumeClaim:
            claimName: lotse-daten
        - name: tmp
          emptyDir: {}
---
apiVersion: v1
kind: Service
metadata:
  name: lotse
spec:
  type: {{ .Values.lotse.service.typ }}
  selector:
    app: lotse
  ports:
    - port: 8080
      targetPort: 8080
      {{- if eq .Values.lotse.service.typ "NodePort" }}
      nodePort: {{ .Values.lotse.service.nodePort }}
      {{- end }}
Line Meaning
57 only if lotse.protokoll.zugriffe is true; {{- removes the empty line before it
58–59 the variable that gunicorn reads at startup
60 end of the condition

Step 10 – create the deletion CronJob. It runs every night at 03:17, uses the same image as the Lotse (find is already in it) and mounts the same volume.

# on werk1
nano ~/lotse/chart/templates/protokoll-aufraeumen.yaml
~/lotse/chart/templates/protokoll-aufraeumen.yaml new file
# Aufbewahrung (Art. 19 AI Act): Ereignisdateien nach der festgelegten Frist löschen
apiVersion: batch/v1
kind: CronJob
metadata:
  name: lotse-protokoll-aufraeumen
spec:
  schedule: "17 3 * * *"
  concurrencyPolicy: Forbid
  jobTemplate:
    spec:
      backoffLimit: 0
      template:
        spec:
          restartPolicy: Never
          automountServiceAccountToken: false
          securityContext:
            runAsNonRoot: true
            runAsUser: 10001
            runAsGroup: 10001
            fsGroup: 10001
            seccompProfile:
              type: RuntimeDefault
          containers:
            - name: aufraeumen
              image: {{ .Values.lotse.image }}
              command:
                - find
                - /daten/protokoll
                - -name
                - "ereignisse-*.jsonl"
                - -mtime
                - "+{{ .Values.lotse.protokoll.aufbewahrungTage }}"
                - -print
                - -delete
              securityContext:
                allowPrivilegeEscalation: false
                readOnlyRootFilesystem: true
                capabilities:
                  drop:
                    - ALL
              volumeMounts:
                - name: daten
                  mountPath: /daten
          volumes:
            - name: daten
              persistentVolumeClaim:
                claimName: lotse-daten
Line Setting Meaning
7 schedule: "17 3 * * *" minute 17, hour 3, every day; not on the hour, when all the other jobs run
8 concurrencyPolicy: Forbid no second run while one is still running
11 backoffLimit: 0 don’t repeat on error; an error should stand out, not disappear
15 automountServiceAccountToken: false the job needs no access to the Kubernetes API
27–34 find … -mtime +210 -print -delete files whose last modification is more than 210 full days ago: first print, then delete
30 "ereignisse-*.jsonl" in quotation marks, so that YAML doesn’t read the asterisk as an alias
35–40 securityContext the same restrictions as for the Lotse from Day 5

find runs in the container; you don’t type it. -print before -delete makes sure the job log shows what was deleted. Deleting should be traceable, too.

Step 11 – check the chart.

# on werk1
helm lint ~/lotse/chart --set lotse.adminPasswort=x
  • --set lotse.adminPasswort=x: a placeholder, because the template aborts without a password (Day 5).

Expected:

==> Linting /home/ubuntu/lotse/chart
[INFO] Chart.yaml: icon is recommended

1 chart(s) linted, 0 chart(s) failed

Step 12 – look at the CronJob the way Kubernetes receives it.

# on werk1
helm template lotse ~/lotse/chart --set lotse.adminPasswort=x --show-only templates/protokoll-aufraeumen.yaml

Expected (excerpt – look for the line with "+210"):

              command:
                - find
                - /daten/protokoll
                - -name
                - "ereignisse-*.jsonl"
                - -mtime
                - "+210"
                - -print
                - -delete

Step 13 – roll out. No more --set lotse.image: the image is now in the chart.

# on werk1
helm upgrade lotse ~/lotse/chart -n lotse --set-file lotse.adminPasswort=$HOME/geheim/admin-passwort --wait --timeout 5m

Expected:

Release "lotse" has been upgraded. Happy Helming!
NAME: lotse
LAST DEPLOYED: Fri Dec  4 08:05:45 2026
NAMESPACE: lotse
STATUS: deployed
REVISION: 14
DESCRIPTION: Upgrade complete
TEST SUITE: None
NOTES:
Bewerbungslotse 1.1.0-rc2 (Chart 1.1.0-rc.2) ist installiert.

Hersteller:      Beispielwerk GmbH
Sicherheit:      [email protected]
Updates bis:     12/2032
Anleitung:       helm show readme <chart>

Step 14 – compare the three version sources.

# on werk1
helm list -n lotse

Expected:

NAME    NAMESPACE   REVISION    UPDATED                                 STATUS      CHART                       APP VERSION
lotse   lotse       14          2026-12-04 08:05:45.15176032 +0000 UTC  deployed    bewerbungslotse-1.1.0-rc.2  1.1.0-rc2
# on werk1
curl -s http://10.43.146.193:8080/gesund

Expected:

{"status":"ok","version":"1.1.0-rc2"}

What you see: NOTES, helm list and /gesund say the same thing. That is how it should be.

Step 15 – look at the CronJob.

# on werk1
kubectl -n lotse get cronjob

Expected:

NAME                         SCHEDULE     TIMEZONE   SUSPEND   ACTIVE   LAST SCHEDULE   AGE
lotse-protokoll-aufraeumen   17 3 * * *   <none>     False     0        <none>          7s

TIMEZONE <none> means: the schedule applies in the time zone of the kube-controller-manager, on werk1 UTC.

Back to the home directory:

# on werk1
cd

Remember: The tachograph records number plates, not drivers’ names. The application file number links the log to the application file, but only whoever may read the application file learns the name.

Save your progress? Sign up for free

Drill 3: Recording and reading out trips

Where you are: on werk1.

What you have afterwards: four real events, their copy in ~/kurs/11/ereignisse.jsonl and proof that no names are in it.

Step 1 – trigger an assessment. Jonas’s application from Day 0.

# on werk1
curl -s -X POST -H "Content-Type: application/json" --data @kurs/00/bewerbung-jonas.json http://10.43.146.193:8080/api/bewerbungen -o kurs/11/antwort-jonas.json
# on werk1
jq -r .nummer kurs/11/antwort-jonas.json

Expected (your number differs):

e35b8423

Step 2 – read the application file without logging in. This is the open gap (d) from Day 9. Now at least it leaves a trace. Insert your number.

# on werk1
curl -s -o /dev/null -w "%{http_code}\n" http://10.43.146.193:8080/api/bewerbungen/e35b8423
  • -o /dev/null: throw away the response.
  • -w "%{http_code}\n": print only the HTTP status.

Expected:

200

Step 3 – export properly. curl asks for the password from ~/geheim/admin-passwort.

# on werk1
curl -s -o /dev/null -w "%{http_code}\n" -u admin http://10.43.146.193:8080/api/admin/export

Expected:

200

Step 4 – fail with the old default password. The way an attacker who knows the instructions for 1.0.0 would try it.

# on werk1
curl -s -o /dev/null -w "%{http_code}\n" -u admin:lotse http://10.43.146.193:8080/api/admin/export

Expected:

401

Step 5 – read the log.

# on werk1
kubectl -n lotse logs deploy/lotse

Expected:

[2026-12-04 08:05:48 +0000] [1] [INFO] Starting gunicorn 22.0.0
[2026-12-04 08:05:48 +0000] [1] [INFO] Listening at: http://0.0.0.0:8080 (1)
[2026-12-04 08:05:48 +0000] [1] [INFO] Using worker: sync
[2026-12-04 08:05:48 +0000] [7] [INFO] Booting worker with pid: 7
10.42.1.1 - - [04/Dec/2026:08:05:49 +0000] "GET /gesund HTTP/1.1" 200 38 "-" "kube-probe/1.37"
10.42.0.0 - - [04/Dec/2026:08:05:52 +0000] "GET /gesund HTTP/1.1" 200 38 "-" "curl/8.5.0"
10.42.1.1 - - [04/Dec/2026:08:05:59 +0000] "GET /gesund HTTP/1.1" 200 38 "-" "kube-probe/1.37"
{"zeit": "2026-12-04T08:06:22+00:00", "ereignis": "bewertung", "system": "Bewerbungslotse 1.1.0-rc2", "akte": "e35b8423", "modell": "qwen3:4b-instruct", "dauer_ms": 21854, "passung": 1}
10.42.0.0 - - [04/Dec/2026:08:06:22 +0000] "POST /api/bewerbungen HTTP/1.1" 201 458 "-" "curl/8.5.0"
10.42.1.1 - - [04/Dec/2026:08:06:22 +0000] "GET /gesund HTTP/1.1" 200 38 "-" "kube-probe/1.37"
10.42.1.1 - - [04/Dec/2026:08:06:22 +0000] "GET /gesund HTTP/1.1" 200 38 "-" "kube-probe/1.37"
10.42.1.1 - - [04/Dec/2026:08:06:29 +0000] "GET /gesund HTTP/1.1" 200 38 "-" "kube-probe/1.37"
{"zeit": "2026-12-04T08:06:30+00:00", "ereignis": "akte_gelesen", "system": "Bewerbungslotse 1.1.0-rc2", "akte": "e35b8423"}
10.42.0.0 - - [04/Dec/2026:08:06:30 +0000] "GET /api/bewerbungen/e35b8423 HTTP/1.1" 200 458 "-" "curl/8.5.0"
{"zeit": "2026-12-04T08:06:31+00:00", "ereignis": "export", "system": "Bewerbungslotse 1.1.0-rc2", "anzahl": 5}
10.42.0.0 - admin [04/Dec/2026:08:06:31 +0000] "GET /api/admin/export HTTP/1.1" 200 1887 "-" "curl/8.5.0"
{"zeit": "2026-12-04T08:06:31+00:00", "ereignis": "export_abgelehnt", "system": "Bewerbungslotse 1.1.0-rc2"}
10.42.0.0 - admin [04/Dec/2026:08:06:32 +0000] "GET /api/admin/export HTTP/1.1" 401 317 "-" "curl/8.5.0"

What you see: Two logs run into each other.

Line type Source Content
{"zeit": …} your event log what the Lotse did in business terms
10.42… "GET …" gunicorn’s access log who called which address
kube-probe/1.37 the kubelet’s readiness probe every ten seconds, noise

Three things stand out:

  1. The assessment took 21,854 ms, almost 22 seconds. That is a measured value you need on Day 14 for post-market monitoring.
  2. The probe lines are the majority. At six lines per minute, more than a million lines that say nothing pile up in six months. That is why the event log is in a file of its own.
  3. The source address is 10.42.0.0, not the real address of your machine. You know this from Day 8: flannel translates the address on the way. So the access log says less about the caller than it seems.

Step 6 – look at the driver card.

# on werk1
kubectl -n lotse exec deploy/lotse -- ls -l /daten/protokoll

Expected:

total 4
-rw-r--r-- 1 10001 10001 532 Dec  4 08:06 ereignisse-2026-12.jsonl

Step 7 – fetch a copy for evaluation. kubectl exec … cat prints the content, and > writes it to a file on werk1.

# on werk1
kubectl -n lotse exec deploy/lotse -- cat /daten/protokoll/ereignisse-2026-12.jsonl > ~/kurs/11/ereignisse.jsonl
# on werk1
wc -l ~/kurs/11/ereignisse.jsonl

Expected:

4 /home/ubuntu/kurs/11/ereignisse.jsonl

Four lines, four events. No probe line, no access log.

Step 8 – search for the name.

# on werk1
grep -c "Jonas" ~/kurs/11/ereignisse.jsonl

Expected:

0

Step 9 – search for the application text. Jonas writes about the restaurant trade (“Gastronomie”).

# on werk1
grep -c "Gastronomie" ~/kurs/11/ereignisse.jsonl

Expected:

0

Step 10 – the cross-check in the response. So that you know grep finds anything at all:

# on werk1
grep -c "Jonas" ~/kurs/11/antwort-jonas.json

Expected:

1

Step 11 – read the assessments as a table.

# on werk1
jq -r 'select(.ereignis == "bewertung") | [.zeit, .akte, .system, .dauer_ms, .passung] | @tsv' ~/kurs/11/ereignisse.jsonl
  • select(.ereignis == "bewertung"): only lines of this event. jq reads JSON Lines line by line, without .[].

Expected:

2026-12-04T08:06:22+00:00   e35b8423    Bewerbungslotse 1.1.0-rc2   21854   1

Remember: Check data minimisation with a cross-check: the name is in the application file (1 match), but not in the log (0 matches). Only both numbers together prove something.

Save your progress? Sign up for free

Drill 4: The deletion deadline

Where you are: on werk1.

What you have afterwards: a tested deletion job: it deletes a practice file that is too old and leaves a young one in place. In addition, gap (l) in the risk assessment marked as “umgesetzt in 1.1.0-rc2” (implemented in 1.1.0-rc2), and commit 18d6717.

A CronJob that deletes at 03:17 at night is something you never see at work. And you don’t have real logs that are 210 days old yet. You therefore test it with an empty practice file to which you give an old date.

Step 1 – calculate the cut-off date.

# on werk1
date -u -d "2026-12-04 - 210 days" +%F
  • -d "… - 210 days": date arithmetic in GNU date.
  • +%F: output as YYYY-MM-DD.

Expected:

2026-05-08

Everything last modified before 8 May 2026 has to go.

Step 2 – create a practice file with an old date.

# on werk1
kubectl -n lotse exec deploy/lotse -- touch -d 2026-04-30 /daten/protokoll/ereignisse-uebung.jsonl
  • touch -d 2026-04-30: creates the file (empty) and sets its modification date to 30 April.
# on werk1
kubectl -n lotse exec deploy/lotse -- ls -l /daten/protokoll

Expected:

total 4
-rw-r--r-- 1 10001 10001 532 Dec  4 08:06 ereignisse-2026-12.jsonl
-rw-r--r-- 1 10001 10001   0 Apr 30  2026 ereignisse-uebung.jsonl

Step 3 – run the CronJob once now.

# on werk1
kubectl -n lotse create job --from=cronjob/lotse-protokoll-aufraeumen aufraeumen-test
  • --from=cronjob/<name>: a one-off job from the CronJob’s template.
  • aufraeumen-test: the name of this run.

Expected:

job.batch/aufraeumen-test created

Step 4 – wait for the end.

# on werk1
kubectl -n lotse wait --for=condition=complete job/aufraeumen-test --timeout=120s

Expected:

job.batch/aufraeumen-test condition met

Step 5 – read what the job deleted.

# on werk1
kubectl -n lotse logs job/aufraeumen-test

Expected:

/daten/protokoll/ereignisse-uebung.jsonl
# on werk1
kubectl -n lotse exec deploy/lotse -- ls -l /daten/protokoll

Expected:

total 4
-rw-r--r-- 1 10001 10001 532 Dec  4 08:06 ereignisse-2026-12.jsonl

What you see: The old practice file is gone, today’s real log stays.

Step 6 – the cross-check: a young file. A deletion job that deletes too much would be worse than none at all. The practice file now gets a date after the cut-off date.

# on werk1
kubectl -n lotse exec deploy/lotse -- touch -d 2026-06-15 /daten/protokoll/ereignisse-uebung.jsonl
# on werk1
kubectl -n lotse create job --from=cronjob/lotse-protokoll-aufraeumen aufraeumen-test-2
# on werk1
kubectl -n lotse wait --for=condition=complete job/aufraeumen-test-2 --timeout=120s

Expected:

job.batch/aufraeumen-test-2 condition met
# on werk1
kubectl -n lotse logs job/aufraeumen-test-2

Expected: no output.

# on werk1
kubectl -n lotse exec deploy/lotse -- ls -l /daten/protokoll

Expected:

total 4
-rw-r--r-- 1 10001 10001 532 Dec  4 08:06 ereignisse-2026-12.jsonl
-rw-r--r-- 1 10001 10001   0 Jun 15 00:00 ereignisse-uebung.jsonl

What you see: No entry in the log, the file from 15 June stays. The boundary sits where it should.

Step 7 – clean up. The practice file and the two test runs.

# on werk1
kubectl -n lotse exec deploy/lotse -- rm /daten/protokoll/ereignisse-uebung.jsonl
# on werk1
kubectl -n lotse delete job aufraeumen-test aufraeumen-test-2

Expected:

job.batch "aufraeumen-test" deleted from lotse namespace
job.batch "aufraeumen-test-2" deleted from lotse namespace

Step 8 – update the risk assessment. Point (l) is implemented, but in a pre-release. The assessment applies to 1.0.2, which is why it doesn’t say “erfüllt” (met) there, but honestly “umgesetzt in 1.1.0-rc2” (implemented in 1.1.0-rc2).

# on werk1
nano ~/lotse/doku/risikobewertung.md
~/lotse/doku/risikobewertung.md changes in green
# Bewertung der Cybersicherheitsrisiken (Art. 13 Abs. 3, Anhang VII Nr. 3)

Produkt: Bewerbungslotse 1.0.2 · Stand: 2026-12-04 · Nächste Prüfung: bei jeder Version

## Grundlage

- Zweckbestimmung: Bewerbungen mit einem Sprachmodell vorsortieren
  (Passung 1 bis 5 mit Begründung), Entscheidung trifft ein Mensch.
- Vorhersehbare Fehlanwendung: Dienst per NodePort ins Internet stellen,
  Bewertung ungeprüft als Absage verwenden.
- Betriebsumgebung: Kubernetes beim gewerblichen Betreiber, eigenes Ollama im Cluster.
- Zu schützende Werte: Bewerberdaten (personenbezogen), Bewertungen, Verfügbarkeit.
- Nutzungsdauer: bis 12/2032 (Unterstützungszeitraum, PRODUKT.md).

## Anhang I Teil I Nr. 2

| Buchst. | Anforderung | anwendbar | Umsetzung | Nachweis | Stand |
|---|---|---|---|---|---|
| a | ohne bekannte ausnutzbare Schwachstellen | ja | Updates 1.0.1/1.0.2, VEX für nicht Betroffenes | pruefberichte/1.0.2/grype-vex.json | erfüllt |
| b | sichere Standardkonfiguration, Zurücksetzen | ja | kein Standardpasswort, ClusterIP, --reset-values | pruefberichte/1.0.2/trivy-config.json | erfüllt |
| c | Sicherheitsupdates | ja | signierte Versionen, helm upgrade; kein Automatismus, weil Betreiber Wartungsfenster plant | SECURITY.md, csaf/ | erfüllt |
| d | Schutz vor unbefugtem Zugriff, Meldung | ja | Export mit Passwort; Akten ohne Anmeldung lesbar, keine Meldung | – | offen |
| e | Vertraulichkeit | ja | nur im Cluster; kein TLS Lotse–Ollama, Akten unverschlüsselt | – | offen |
| f | Integrität | ja | signierte Images, Dateisystem nur lesbar, BW-2026-002 behoben | pruefberichte/1.0.2/cosign-verify.json | erfüllt |
| g | Datenminimierung | ja | Akte speichert Name, Stelle, Bewertung, nicht den Bewerbungstext | – | erfüllt |
| h | Verfügbarkeit | ja | ein sync-Worker: während einer Bewertung wartet jede Anfrage | – | offen |
| i | Auswirkung auf andere Dienste | ja | CPU und Speicher begrenzt | chart/templates/lotse.yaml | erfüllt |
| j | geringe Angriffsfläche | ja | ClusterIP, NetworkPolicies, ohne pip | PRODUKT.md | erfüllt |
| k | Auswirkungen begrenzen | ja | Benutzer 10001, keine Capabilities, kein SA-Token | pruefberichte/1.0.2/trivy-config.json | erfüllt |
| l | Aufzeichnung, Opt-out | ja | 1.1.0-rc2: Ereignisprotokoll ohne Namen, Zugriffsprotokoll abschaltbar (lotse.protokoll.zugriffe) | chart/values.yaml, chart/templates/protokoll-aufraeumen.yaml | umgesetzt in 1.1.0-rc2 |
| m | Daten sicher löschen | ja | helm uninstall entfernt PVC lotse-daten; keine Einzellöschung | – | offen |

## Anhang I Teil I Nr. 1 und Teil II

- Nr. 1 (angemessenes Niveau): über die Tabelle oben, offene Punkte unten.
- Teil II Nr. 1–8: Stückliste, Behandlung, Tests, Hinweise, CVD-Konzept,
  Kontaktadresse, sichere Verteilung, kostenlose Updates – siehe README.md Nr. 2 b.

## Offene Punkte (vor dem Inverkehrbringen zu schließen)

- d/e: Anmeldung für das Lesen von Akten, TLS zum Modell
- h: mehrere Worker oder Threads
- l: Zugriffs- und Entscheidungsprotokoll mit Opt-out – umgesetzt in 1.1.0-rc2, Freigabe mit 1.1.0
- m: Einzelne Akte löschen
# on werk1
grep -c "| offen |" ~/lotse/doku/risikobewertung.md

Expected:

4

Of five open points, four are still open: d, e, h, m.

Step 9 – commit.

# on werk1
git -C ~/lotse add app.py chart doku/risikobewertung.md
  • chart: the whole folder, so that the new file protokoll-aufraeumen.yaml comes along.
# on werk1
git -C ~/lotse commit -m "1.1.0-rc2: Fahrtenschreiber (Art. 12/19 AI Act), Zugriffsprotokoll abschaltbar (CRA Anhang I Teil I Nr. 2 l)"
# on werk1
git -C ~/lotse log --oneline -1

Expected:

18d6717 1.1.0-rc2: Fahrtenschreiber (Art. 12/19 AI Act), Zugriffsprotokoll abschaltbar (CRA Anhang I Teil I Nr. 2 l)

Remember: You check a deletion deadline in both directions: the old file must go, the young one must stay. And deleting, too, leaves a line in the log.

Save your progress? Sign up for free

Drill 5: Switching off the visitor list

Where you are: on werk1.

What you have afterwards: measured proof that the opt-out switches off the access log, while the tachograph keeps running.

The CRA requires an opt-out mechanism. You built it in values.yaml. Whether it works, you only know once you have used it.

Step 1 – roll out with the access log switched off.

# on werk1
helm upgrade lotse ~/lotse/chart -n lotse --set-file lotse.adminPasswort=$HOME/geheim/admin-passwort --set lotse.protokoll.zugriffe=false --wait --timeout 5m

Expected (excerpt):

Release "lotse" has been upgraded. Happy Helming!
NAME: lotse
LAST DEPLOYED: Fri Dec  4 08:08:50 2026
NAMESPACE: lotse
STATUS: deployed
REVISION: 15

Step 2 – check the container’s environment.

# on werk1
kubectl -n lotse get deploy lotse -o jsonpath="{.spec.template.spec.containers[0].env[*].name}{\"\n\"}"
  • env[*].name: of all environment variables, only the names.

Expected:

OLLAMA_URL MODELL ADMIN_PASSWORT

GUNICORN_CMD_ARGS is missing.

Step 3 – read the log.

# on werk1
kubectl -n lotse logs deploy/lotse

Expected:

[2026-12-04 08:08:53 +0000] [1] [INFO] Starting gunicorn 22.0.0
[2026-12-04 08:08:53 +0000] [1] [INFO] Listening at: http://0.0.0.0:8080 (1)
[2026-12-04 08:08:53 +0000] [1] [INFO] Using worker: sync
[2026-12-04 08:08:53 +0000] [7] [INFO] Booting worker with pid: 7

No more probe lines, although the probe keeps asking every ten seconds.

Step 4 – is the tachograph still running? The wrong password once more.

# on werk1
curl -s -o /dev/null -w "%{http_code}\n" -u admin:lotse http://10.43.146.193:8080/api/admin/export

Expected:

401
# on werk1
kubectl -n lotse logs deploy/lotse --tail=1
  • --tail=1: only the last line.

Expected:

{"zeit": "2026-12-04T08:09:09+00:00", "ereignis": "export_abgelehnt", "system": "Bewerbungslotse 1.1.0-rc2"}

What you see: The visitor list is silent, the tachograph writes. The opt-out under the CRA doesn’t touch the obligation under Article 12 AI Act.

Step 5 – switch it back on. Without --set, the default value true from values.yaml applies.

# on werk1
helm upgrade lotse ~/lotse/chart -n lotse --set-file lotse.adminPasswort=$HOME/geheim/admin-passwort --wait --timeout 5m

Expected (excerpt):

STATUS: deployed
REVISION: 16
# on werk1
kubectl -n lotse get deploy lotse -o jsonpath="{.spec.template.spec.containers[0].env[*].name}{\"\n\"}"

Expected:

OLLAMA_URL MODELL ADMIN_PASSWORT GUNICORN_CMD_ARGS

Remember: Two obligations, two logs: the deployer may switch off the visitor list under the CRA, but not the tachograph under the AI Act. Whoever writes both into one file can fulfil neither of them cleanly.

Save your progress? Sign up for free

Diagnosis task

In the afternoon, the HR department asks about Jonas’s assessment from the morning. In between, a colleague restarted the Lotse because it “hung”. You search the log.

The symptom:

# on werk1
kubectl -n lotse rollout restart deploy/lotse
# on werk1
kubectl -n lotse rollout status deploy/lotse --timeout=120s

Expected:

Waiting for deployment "lotse" rollout to finish: 1 old replicas are pending termination...
Waiting for deployment "lotse" rollout to finish: 1 old replicas are pending termination...
deployment "lotse" successfully rolled out
# on werk1
kubectl -n lotse logs deploy/lotse

Expected:

Found 2 pods, using pod/lotse-6b6f7db479-ndw28
[2026-12-04 08:07:58 +0000] [1] [INFO] Starting gunicorn 22.0.0
[2026-12-04 08:07:58 +0000] [1] [INFO] Listening at: http://0.0.0.0:8080 (1)
[2026-12-04 08:07:58 +0000] [1] [INFO] Using worker: sync
[2026-12-04 08:07:58 +0000] [7] [INFO] Booting worker with pid: 7
10.42.1.1 - - [04/Dec/2026:08:07:59 +0000] "GET /gesund HTTP/1.1" 200 38 "-" "kube-probe/1.37"

The assessment is gone. Have you just lost logs that you must keep for six months? Think about it before you read on.

Solution path.

Step 1 – ask the previous container.

# on werk1
kubectl -n lotse logs deploy/lotse --previous
  • --previous: the log of the last terminated container in the same pod.

Expected:

Error from server (BadRequest): previous terminated container "lotse" in pod "lotse-6b6f7db479-ndw28" not found

--previous only helps if a container restarted in the same pod. rollout restart replaces the whole pod. The old log went with the old pod.

Step 2 – ask the driver card.

# on werk1
kubectl -n lotse exec deploy/lotse -- wc -l /daten/protokoll/ereignisse-2026-12.jsonl

Expected:

4 /daten/protokoll/ereignisse-2026-12.jsonl

Cause: kubectl logs is the display, not the memory. Kubernetes keeps the standard output only as long as the container exists, and rotates it by size even before that. “Found 2 pods” also shows: during the switch, the old and the new pod run side by side for a short time, and kubectl logs deploy/… picks one of them.

Fix: Nothing to repair if you built Drill 2 correctly. The four events are on the volume. For information requests, notifications and authorities, you always read the file, never kubectl logs. Had you built only print() without a file, the logs would be lost with every update. With a six-month retention obligation and weekly updates, that would be a violation nobody notices.

Remember: kubectl logs shows the display, not the driver card. What you have to keep belongs on a volume or in a log system that survives the pod.

Challenge

Jonas writes under Article 86 AI Act: he would like to know what role an AI system played in his application. At the same time, IT security asks whether anyone tried to log in to the export with a wrong password.

Answer both from your copy ~/kurs/11/ereignisse.jsonl from Drill 3.

  1. All events for Jonas’s application file (your number from Drill 3), compact, one line per event.
  2. The number of rejected exports.
  3. All export events with only time and type.

Solution.

Step 1 – everything for one application file.

# on werk1
jq -c 'select(.akte == "e35b8423")' ~/kurs/11/ereignisse.jsonl
  • -c: compact, one object per line.

Expected:

{"zeit":"2026-12-04T08:06:22+00:00","ereignis":"bewertung","system":"Bewerbungslotse 1.1.0-rc2","akte":"e35b8423","modell":"qwen3:4b-instruct","dauer_ms":21854,"passung":1}
{"zeit":"2026-12-04T08:06:30+00:00","ereignis":"akte_gelesen","system":"Bewerbungslotse 1.1.0-rc2","akte":"e35b8423"}

Step 2 – count rejected exports.

# on werk1
jq -s 'map(select(.ereignis == "export_abgelehnt")) | length' ~/kurs/11/ereignisse.jsonl
  • -s (slurp): first collect all lines into a list, so that length can count.
  • map(select(…)): keep only the matching entries from the list.

Expected:

1

Step 3 – exports with time and type.

# on werk1
jq -c 'select(.ereignis | startswith("export")) | {zeit, ereignis}' ~/kurs/11/ereignisse.jsonl
  • startswith("export"): matches export and export_abgelehnt.
  • {zeit, ereignis}: a new object with only these two fields.

Expected:

{"zeit":"2026-12-04T08:06:31+00:00","ereignis":"export"}
{"zeit":"2026-12-04T08:06:31+00:00","ereignis":"export_abgelehnt"}

What you see: For Jonas you now have a reliable answer: assessed on 4 December at 08:06:22 UTC by Bewerbungslotse 1.1.0-rc2 with qwen3:4b-instruct, score 1, processing time 22 seconds, retrieved once eight seconds later. Who retrieved it, you don’t know: the application file was readable without logging in (gap (d)), and the access log only shows the translated address 10.42.0.0. That, too, honestly belongs in the answer.

The rejected export directly after the successful one was your own attempt from Drill 3. In real operation, an accumulation of such lines would trigger an investigation. How to turn that into a notification, you know from Day 8.

Remember: A good log answers an information request with a single jq command. What it cannot answer, you add in writing instead of guessing.

Save your progress? Sign up for free

Checkpoint

# on werk1
helm list -n lotse

Expected:

NAME    NAMESPACE   REVISION    UPDATED                                 STATUS      CHART                       APP VERSION
lotse   lotse       16          2026-12-04 08:09:11.722707583 +0000 UTC deployed    bewerbungslotse-1.1.0-rc.2  1.1.0-rc2
# on werk1
curl -s http://10.43.146.193:8080/gesund

Expected:

{"status":"ok","version":"1.1.0-rc2"}
# on werk1
kubectl -n lotse get cronjob lotse-protokoll-aufraeumen

Expected:

NAME                         SCHEDULE     TIMEZONE   SUSPEND   ACTIVE   LAST SCHEDULE   AGE
lotse-protokoll-aufraeumen   17 3 * * *   <none>     False     0        <none>          3m42s
# on werk1
kubectl -n lotse exec deploy/lotse -- wc -l /daten/protokoll/ereignisse-2026-12.jsonl

Expected:

5 /daten/protokoll/ereignisse-2026-12.jsonl

Five: the four from Drill 3 and the rejected export from Drill 5.

# on werk1
git -C ~/lotse log --oneline --decorate -3

Expected:

18d6717 (HEAD -> main) 1.1.0-rc2: Fahrtenschreiber (Art. 12/19 AI Act), Zugriffsprotokoll abschaltbar (CRA Anhang I Teil I Nr. 2 l)
ba3cbb8 1.1.0-rc1: KI-Ausgaben gekennzeichnet (Art. 50 AI Act), Einstufung als Hochrisiko-KI-System
4dbb9e1 (tag: chart-1.0.3) Technische Dokumentation 1.0.2 (Anhang VII CRA), Chart 1.0.3 mit Nutzerinformationen

Test yourself

  1. Why does the event log contain application file numbers but no names, and why is that still enough for an information request?
  2. What is the difference between the event log and the access log, legally and technically?
  3. Why do you test the deletion job with two practice files and not with one?
  4. After a rollout restart, kubectl logs --previous returns an error. Why, and where do you find the logs?
  5. Why 210 days and not exactly six months?
  6. A deployer sets lotse.protokoll.zugriffe=false. What does the Lotse still record?

Answers:

  1. Data minimisation: the log only needs the number plate, not the driver. Via the application file number you find the application file, and that contains the name, protected by the application file’s access rules.
  2. The event log fulfils Article 12 AI Act, describes business actions, lies as a file on the volume and cannot be switched off. The access log fulfils Annex I, Part I, point 2(l) CRA, comes from gunicorn, only ends up on standard output and needs an opt-out.
  3. The old file shows that the job deletes, the young one that it doesn’t delete too much. Only both together prove that the boundary is right.
  4. --previous only applies to a restart in the same pod. rollout restart replaces the pod, and the old log is gone. The events are in /daten/protokoll/ on the volume.
  5. A month’s file gets its last line at the end of the month, and the job measures from the last modification. With one month of buffer, every line safely stays for at least six months.
  6. Still all four events in the file and on standard output, measured in Drill 5 with export_abgelehnt. Only the lines per HTTP request disappear.

Interview note

“How would you implement logging for an AI system in HR?” A strong answer separates two obligations: the business event log under Article 12 AI Act, pseudonymous via application file numbers, with system version, model and duration, kept for at least six months (Article 19, Article 26(6)), and the technical access log with an opt-out under the CRA. Two pieces of evidence belong to it: a cross-check that no names are in the log, and a deletion job that is tested in both directions. Whoever also knows that kubectl logs doesn’t survive a pod replacement and that the source address is translated behind flannel shows operational experience.

Enterprise note

In larger environments, the service writes only to standard output, and a log collector (such as Fluent Bit, Vector or the OpenTelemetry Collector) brings the lines into a central system such as Loki or OpenSearch. Retention and deletion are governed there by a policy per data stream, and access to logs with personal data is itself logged. The separation from this chapter remains: business events get a stream of their own with a long period, access and probe lines a short one. The period is recorded in the records of processing activities under Article 30 GDPR, and the works council has a say in logs about employees, because they are suitable for monitoring performance.

Summary

  • Article 12 AI Act requires automatic logging, Article 19 and Article 26(6) at least six months of retention; the GDPR requires data minimisation and an upper limit.
  • The Lotse’s event log knows four events and links via the application file number, not via names. The cross-check with grep -c proves it.
  • The events are stored as JSON Lines on the volume, one file per month, and survive every pod replacement.
  • A CronJob deletes after 210 days. Tested with an old and a young practice file.
  • gunicorn’s access log hangs on lotse.protokoll.zugriffe and can be switched off (Annex I, Part I, point 2(l) CRA). The event log keeps running.
  • Image, VERSION and appVersion are back in line: 1.1.0-rc2, chart 1.1.0-rc.2, revision 16.

Commands at a glance

Command Purpose
kubectl -n <ns> logs deploy/<name> standard output of the current container
kubectl -n <ns> logs deploy/<name> --tail=1 only the last line
kubectl -n <ns> logs deploy/<name> --previous log of the last terminated container in the same pod
kubectl -n <ns> exec deploy/<name> -- cat <file> > <copy> fetch a file from the pod
podman push --digestfile <file> <image> push and record the digest
helm template … --show-only templates/<file> see a template the way Kubernetes receives it
helm upgrade … --set lotse.protokoll.zugriffe=false switch off the access log
kubectl -n <ns> create job --from=cronjob/<name> <run> run a CronJob once right away
kubectl -n <ns> wait --for=condition=complete job/<run> --timeout=120s wait for a job to finish
kubectl -n <ns> exec deploy/<name> -- touch -d <date> <file> practice file with an old date
date -u -d "<date> - 210 days" +%F calculate the cut-off date
grep -c "<name>" <log> check data minimisation (with a cross-check)
jq -c 'select(.akte == "<number>")' <log> all events for one application file
jq -s 'map(select(.ereignis == "<type>")) \| length' <log> count events of one type

Contents

More