Abdoulaye Touré
Retour aux articles

Analyse de Logs avec ELK Stack

4 min

Standardisez vos logs avec ECS pour corréler facilement événements réseau, système et application. Utilisez des pipelines Logstash simples et testables.

Pipeline Logstash (nginx + syslog)

input { beats { port => 5044 } }
filter {
  if [fileset][module] == "nginx" {
    grok { match => { "message" => "%{NGINXACCESS}" } }
    mutate { add_field => { "event.dataset" => "nginx.access" } }
  }
  if [event][module] == "system" {
    # syslog → ECS
    mutate { add_field => { "event.dataset" => "system.syslog" } }
  }
}
output {
  elasticsearch { hosts => ["http://elasticsearch:9200"] index => "logs-%{+YYYY.MM.dd}" }
}

Exemple de corrélation (KQL Kibana)

event.dataset: "nginx.access" and url.path: "/wp-login.php" and http.response.status_code: 401

Suricata → ELK

# filebeat suricata.yml
- type: log
  enabled: true
  paths: ["/var/log/suricata/eve.json"]
  json.keys_under_root: true
  processors:
    - add_fields: { target: "", fields: { event.module: "suricata" } }
NoteVersionnez vos dashboards Kibana (export NDJSON), nommez vos règles et corrélations avec un préfixe explicite (SEC_, DET_, LAB_).