fix(v1.1.13): socket ownership, correlation bugs, keepalive_seq
Some checks failed
Build and Test / test (push) Has been cancelled
Build and Test / build (push) Has been cancelled
Build and Test / docker (push) Has been cancelled

Socket Unix / systemd:
- RuntimeDirectory=logcorrelator dans logcorrelator.service : systemd
  recrée /run/logcorrelator avec logcorrelator:logcorrelator à chaque
  démarrage/restart, éliminant le problème de droits root:root
- Ajout de packaging/rpm/logcorrelator-tmpfiles.conf pour recréer le
  répertoire au boot via systemd-tmpfiles (couche de protection boot)
- Retrait de /var/run/logcorrelator du RPM %files et du %post
- Dockerfile.package : copie de logcorrelator-tmpfiles.conf dans SOURCES/

Corrélation — bugs:
- Fix CRITIQUE emitPendingOrphans : corruption de slice lors de l'expiration
  simultanée de plusieurs orphelins pour la même clé (aliasing du tableau
  sous-jacent, orphelins émis en double et fantômes persistants)
- Fix HAUT rotateOldestA : événement silencieusement perdu même avec
  ApacheAlwaysEmit=true ; retourne désormais *CorrelatedLog propagé dans
  ProcessEvent
- Fix MOYEN processSourceB (pending orphan path) : en mode one_to_many, le
  B event n'était pas bufferisé après corrélation avec un pending orphan A,
  cassant le Keep-Alive pour les requêtes A2+ sur la même connexion
- Fix BAS : suppression du champ mort timer *time.Timer dans pendingOrphan

Corrélation — observabilité:
- Ajout keepalive_seq (1-based) dans NormalizedEvent : numéro de requête
  dans la connexion Keep-Alive, incrémenté par processSourceA
- Tous les logs orphelins incluent désormais keepalive_seq=N
- keepAliveSeqA nettoyé automatiquement à l'expiration du TTL B

Tests: 4 nouveaux tests de non-régression (32 tests au total)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
toto
2026-03-05 16:03:13 +01:00
parent ae3da359fa
commit 7423bb4614
8 changed files with 286 additions and 44 deletions

View File

@ -15,15 +15,16 @@ const (
// NormalizedEvent represents a unified internal event from either source.
type NormalizedEvent struct {
Source EventSource
Timestamp time.Time
SrcIP string
SrcPort int
DstIP string
DstPort int
Headers map[string]string
Extra map[string]any
Raw map[string]any // Original raw data
Source EventSource
Timestamp time.Time
SrcIP string
SrcPort int
DstIP string
DstPort int
Headers map[string]string
Extra map[string]any
Raw map[string]any // Original raw data
KeepAliveSeq int // Request sequence number within the Keep-Alive connection (1-based)
}
// CorrelationKey returns the key used for correlation (src_ip + src_port).