Ship audit logs to Logs & Metrics providers on self-hosted (enterprise)

Aperta
#6,126 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
48/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
postgresql, typescript

Direzione di ricerca

Wait for #6123 to merge, then trace its audit stream and the telemetry provider form and adapter used for log shipping. Check how the local Vector agent routes container logs and how organization and license settings are represented. Done means licensed self-hosted organizations can opt in per log provider, and Vector sends only their audit events to those providers.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

enhancement
What problem will this feature address?

On self-hosted Enterprise, audit logs stay in Dokploy's Postgres. You can browse them in the UI or export them by hand as CSV, TSV or JSON (#5797), but nothing sends them to the log platform where we keep everything else (OpenObserve in our case; Elasticsearch, Loki, Datadog or Splunk for others). To alert on them or keep them under the same retention, someone has to export and upload them manually.

Logs & Metrics already runs a Vector agent that ships container logs to these providers. #6123 adds a structured audit stream, written to stdout as log_type: "dokploy.audit" JSON lines, which Vector ships to ClickHouse. That stream is only enabled when IS_CLOUD is set.

Describe the solution you'd like

A self-hosted Enterprise organization should be able to send its audit events to the Logs & Metrics providers it has already configured.

In the telemetry provider form, when the provider sends logs ("Logs" or "Logs & Metrics"), show an "Also send audit logs" checkbox. It is available only with a valid enterprise license.

On the backend, reuse the audit stream from #6123 and turn it on for self-hosted when a licensed organization has at least one provider with the option enabled.

Vector needs a dedicated route for these events. The local agent currently keeps only container logs whose dokploy.organization.id label matches the organization that claimed it (dokploy_scope_local_only). The Dokploy container has no such label, so its stdout, where the audit lines go, is dropped. The new route would parse the Dokploy container's output, keep the log_type == "dokploy.audit" events that belong to that organization, and send them to the providers that have the option on. Filtering by organization keeps one organization's audit events out of another's provider.

The events go through the same adapter and sink as the provider's container logs, so any provider that supports logs works without provider-specific code. #6123 already redacts the events (keys, URL credentials, PEM blocks, inline command secrets), so this sends nothing the Cloud stream doesn't.

Describe alternatives you've considered
  • Exporting from the Audit Logs page and uploading periodically. It's manual, and alerts would always lag.
  • A scheduled job that reads the audit_log table and pushes new rows to the provider. It would duplicate what Vector already does, and the table only holds the explicit audit() calls, which cover less than the #6123 stream.
  • A separate "Audit logs" option next to Logs and Metrics in the provider select. That means a new signal type across the adapters, the schema and the UI, while the data is just another log stream.
Additional context

This builds on #6123, so we'd wait for it to be merged before starting. If the team already has plans for the self-hosted side of the audit stream, we're happy to follow a different design.

We run Dokploy self-hosted with an Enterprise license and ship our logs to OpenObserve (#5991).

Will you send a PR to implement it?

Yes

Lingua principale
TypeScript
Stelle
38.8k
Fork
3.2k
Merge medio
1g 10h
PR unite (30g)
110

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Dokploy/dokploy

Tutte le issue di Dokploy/dokploy

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.