Event log
The engine's event log for process mining. What it records about people's work, messages and polls, what it never records, how long it is kept, and how to export it as OCEL 2.0 for PM4Py.
On this page
The event log records what happens on the engine as a series of events: a person tests a connection, a message is accepted, a run finishes, a poll runs. Each event names the engine objects it is about (a workflow, a run, a connection, a trigger, a step, a person), so you can follow one message from the listener to its delivery, or see where people get stuck between creating a connection and deploying a workflow.
It is built for process mining. Export a range as OCEL 2.0 (object-centric event log) and load it in PM4Py or another process mining tool.
The event log is not the audit log. The audit log is the compliance record: hash-chained, kept six years by default. The event log is an operational record, kept 30 days by default, and under heavy load or a database outage the engine may drop events rather than slow message processing.
What is recorded
Events come in three families.
| Family | Events |
|---|---|
journey | Sign-ins and refused sign-ins, connections created, changed and tested, samples fetched and saved, workflows created, saved, test-run, dry-run, deployed, turned on and off, polling reset, messages replayed, Agent messages, alert rules created |
message | A message accepted, a run finished (with how many steps ran) or failed (with the class of error and the type of step that failed), a step that failed, an HL7v2 ACK sent (AA, AE, AR), a run retried or held. Off unless you turn it on (below) |
trigger | One event per poll: it ran, failed, waited or was skipped, with the kind of cause only, the items read, pages, new, run, already run and filtered, whether the cursor moved, and its call in the connection's call log; a schedule fired; a webhook or an MLLP message a trigger saw but did not accept (filtered out, workflow off, a resend). A workflow's Recent polls reads the poll events |
Every event has:
- when it happened, its activity (for example
connection.tested) and, where it has one, an outcome:ok,failed,skippedorwaiting - the workspace
- who did it: a person (their engine user id), an API client (its id) or the engine itself, with their role
- the engine ids it is about: workflow and version, run, connection, trigger, step
- how long it took, where that is known
- a few attributes chosen for that activity, such as the adapter type, the step type, an error class or a count
Message events are opt-in
The journey and trigger families are recorded by default. The message family is not: turn it on with EVENT_LOG_FAMILIES=all (or journey,trigger,message).
Message events are written for every message the engine processes, so they add database writes in proportion to your message volume, on the same database that records the messages themselves. The engine keeps that cost small: a message that goes through cleanly is three events (accepted, run finished, and the ACK for MLLP), and a step is recorded only when it fails. Events are written in batches in the background and never make a message wait.
Before you turn message events on for a high-volume engine, check that its database has room for the extra writes: watch the database's CPU and the engine's medhook_event_log_flush_seconds after you turn them on. If the database is busy, turn them on for a shorter window, for example while you study one interface, and lower EVENT_LOG_RETENTION_DAYS to keep the table small.
What is never recorded
The event log holds no PHI. It never records:
- message content, segments, fields or source values
- MRNs, message control ids (MSH-10) or file names
- error text from a source system (only a class, such as
timeout) - email addresses or free text of any kind
Each activity has a fixed list of attributes, and an attribute that is not on the list is dropped before it is stored. Text attributes must be short identifiers (letters, digits and _ . : ^ / -, up to 64 characters), so a sentence or a name cannot be stored by mistake.
Retention
Events are kept for EVENT_LOG_RETENTION_DAYS days, 30 by default. The engine deletes older events every six hours, alongside its other retention work, in batches of 5,000 so no delete holds a long lock. Set EVENT_LOG_RETENTION_DAYS=0 to keep events until you delete them.
Settings
| Variable | Default | What it does |
|---|---|---|
EVENT_LOG_ENABLED | true | false turns the event log off; nothing is recorded |
EVENT_LOG_RETENTION_DAYS | 30 | How long events are kept; 0 keeps them |
EVENT_LOG_FAMILIES | journey,trigger | The families recorded. all (or journey,trigger,message) adds the per-message events; see Message events are opt-in |
EVENT_LOG_BUFFER | 10000 | How many events each engine replica holds in memory while it writes them in batches |
Recording an event never waits for the database. Each replica holds events in memory and writes them every second, or as soon as 500 are waiting. If the buffer is full, or a write fails twice, those events are dropped. The engine's metrics show it:
medhook_event_log_recorded_total: events writtenmedhook_event_log_dropped_total{reason}: events dropped,buffer_fullorinsert_failedmedhook_event_log_rejected_total{reason}: events or attributes refused by the catalogmedhook_event_log_flush_seconds: time to write a batchmedhook_event_log_buffer: events waiting to be written
A replica that is shutting down writes what it holds before it stops.
Read events
GET /api/events returns the workspace's events, newest first. Operators and admins can call it. Filter with from, to, family, activity, workflowId and executionId, and page with limit (up to 1,000) and cursor:
curl -H "Authorization: Bearer $TOKEN" \
"https://engine.example.test/api/events?executionId=$RUN&limit=200"The response is { "events": [...], "nextCursor": "..." }. Pass nextCursor as cursor for the next page; it is null on the last one.
Export as OCEL 2.0
GET /api/events/export?format=ocel2 downloads the workspace's events as OCEL 2.0 JSON. Admins can call it. Without from and to it covers the last day. One export covers at most 31 days; for a longer period, export it in parts. Each export is recorded in the audit log as events.exported, with the range and the number of events.
curl -H "Authorization: Bearer $TOKEN" -o events.ocel.json \
"https://engine.example.test/api/events/export?format=ocel2&from=2026-11-01T00:00:00Z&to=2026-11-08T00:00:00Z"The file has the four OCEL 2.0 collections:
objectTypes:workflow,execution,connection,trigger,stepandusereventTypes: one per activity, with its attributes and their typesobjects: every object the events name. A run and a trigger relate to their workflow (of), a step to its workflow (in)events: each with its time, attributes, and a relationship to each object it is about, qualified by the object's type (actorfor the person)
Object ids carry their type, for example workflow:3f2a… or step:3f2a…:node-4, so ids from different kinds of object never collide.
Analyze with PM4Py
import pm4py
ocel = pm4py.read_ocel2_json("events.ocel.json")
print(ocel.get_summary())
# Follow messages through their workflows (message events on): flatten on runs.
runs = pm4py.ocel_flattening(ocel, "execution")
dfg, start, end = pm4py.discover_dfg(runs)
pm4py.view_dfg(dfg, start, end)
# Where people stall between connecting and deploying: flatten on people.
people = pm4py.ocel_flattening(ocel, "user")
pm4py.view_dfg(*pm4py.discover_dfg(people))
# An object-centric directly-follows graph across every object type.
pm4py.view_ocdfg(pm4py.discover_ocdfg(ocel))