Pular para o conteúdo principal

Audit Logging & Observability

Track changes to critical data with audit logging, and monitor application health with structured logging and observability tools.

Audited Actions

EntityActions Logged
UserLogin, logout, password change
EmployeeCreate, update, deactivate
OrganizationCreate, update, settings change
RoleCreate, update, permission change
InvoiceCreate, send, status change
Time LogCreate, update, delete

Audit Log Fields

FieldDescription
actionCREATE, UPDATE, DELETE, LOGIN, etc.
entityEntity type (User, Employee, etc.)
entityIdID of affected entity
userIdUser who performed action
previousValuesState before change
updatedValuesState after change
ipAddressClient IP address
timestampWhen action occurred

Retention

Audit logs follow configurable retention policies. Default: 24 months.

Structured Logging

  • All authentication events use the NestJS Logger — no console.log calls in auth module.
  • Sensitive data (passwords, tokens, credentials) is never logged.
  • Error messages in logs include only the error message, not full objects or stack traces.

Observability

OpenTelemetry (OTEL)

OpenTelemetry tracing is supported when OTEL_ENABLED=true:

OTEL_ENABLED=true

When enabled, distributed tracing spans are automatically collected for HTTP requests, database queries, and inter-service communication.

Sentry

Sentry integration is available for error tracking via the sentry.dsn configuration. Sentry captures unhandled exceptions, performance metrics, and breadcrumbs for debugging production issues.