Skip to main content

Event Logs

HappyView maintains an internal event log that records system activity — lexicon changes, record operations, Lua script executions and errors, user actions, API key events, backfill jobs, and Jetstream connectivity. Events are stored in the database and queryable via the admin API.

Event types

Events follow a category.action naming convention. Each event has a severity level (info, warn, or error), an optional actor_did (the user who triggered it), an optional subject (what was affected), and a detail JSON object with event-specific data.

Lexicon events

Event TypeSeveritySubjectDetail
lexicon.createdinfoLexicon NSIDrevision, has_script, source
lexicon.updatedinfoLexicon NSIDrevision, has_script, source
lexicon.deletedinfoLexicon NSID

Logged when lexicons are uploaded, updated, or deleted via the admin API. The actor_did is the user who performed the action.

Record events

Event TypeSeveritySubjectDetail
record.createdinfoRecord AT URIcollection, did, rkey
record.deletedinfoRecord AT URIcollection, did, rkey

Logged when records are received from Jetstream and stored or removed from the local database. These are system-triggered events (actor_did is null). If a database error occurs during the operation, the same event type is logged with error severity and the error message is included in the detail.

Script events

Event TypeSeveritySubjectDetail
script.executedinfoMethod NSIDmethod, caller_did, duration_ms
script.errorerrorMethod NSIDerror, script_source, input, caller_did, method

Logged when Lua scripts run for XRPC query or procedure endpoints. Script errors capture the full context needed to reproduce and debug the issue: the error message, the complete Lua script source, the input that triggered it, and the caller's DID.

note

For query scripts (unauthenticated), caller_did and input are omitted from the detail since queries don't have an authenticated user or request body.

User events

Event TypeSeveritySubjectDetail
user.createdinfoNew user DIDtemplate (if used)
user.deletedinfoRemoved user ID
user.bootstrappedinfoBootstrapped user DID
user.permissions_updatedinfoUser IDgranted, revoked
user.super_transferredwarnNew super user IDfrom_user_id

The user.bootstrapped event is logged when the first user is auto-promoted to super user (see Auth - Auto-bootstrap).

Auth events

Event TypeSeveritySubjectDetail
auth.permission_deniederrorEndpoint pathrequired_permission, user_id

Logged when a user attempts to access an endpoint they don't have permission for.

API Key events

Event TypeSeveritySubjectDetail
api_key.createdinfoKey IDname, permissions
api_key.revokedinfoKey IDname

Script Variable events

Event TypeSeveritySubjectDetail
script_variable.upsertedinfoVariable key
script_variable.deletedinfoVariable key

Hook events

Event TypeSeveritySubjectDetail
hook.executedinfoRecord AT URIlexicon_id
hook.dead_letterederrorRecord AT URIlexicon_id, error

Logged when index hooks run. Dead-lettered events indicate a hook failed all retry attempts.

Backfill events

Event TypeSeveritySubjectDetail
backfill.startedinfoCollection NSIDjob_id
backfill.completedinfoCollection NSIDjob_id, total_repos
backfill.failederrorCollection NSIDjob_id, error

See Backfill for background on backfill jobs.

Jetstream events

Event TypeSeveritySubjectDetail
jetstream.connectedinfourl
jetstream.disconnectedwarnreason

Logged when the WebSocket connection to Jetstream is established or lost.

Querying events

Use the admin API to query event logs with filters:

# Get all errors
curl "http://localhost:3000/admin/events?severity=error" -H "$AUTH"

# Get script errors for a specific lexicon
curl "http://localhost:3000/admin/events?event_type=script.error&subject=com.example.feed.like" -H "$AUTH"

# Get all lexicon-related events
curl "http://localhost:3000/admin/events?category=lexicon" -H "$AUTH"

# Paginate through results
curl "http://localhost:3000/admin/events?limit=20&cursor=2026-03-01T11:59:00Z" -H "$AUTH"

See the Admin API reference for full parameter documentation.

Retention

Event logs are automatically cleaned up based on the EVENT_LOG_RETENTION_DAYS environment variable (default: 30 days). A background task runs hourly to delete events older than the configured retention period.

Set EVENT_LOG_RETENTION_DAYS=0 to disable automatic cleanup and keep logs indefinitely.

See Configuration for all environment variables.

Next steps