💻 Développement

dev-log-analyzer

Analyse de logs pour diagnostiquer problèmes et patterns.

⚡ Installation & lancement en 1 commande

Copiez-collez dans votre terminal : le skill s'installe dans ~/.claude/skills et Claude Code se lance directement dessus.

macOS / Linux
curl -fsSL https://raw.githubusercontent.com/khalilbenaz/claude-skills-collection/main/install.sh | sh -s -- dev-log-analyzer --launch
Windows (PowerShell)
iex "& { $(iwr -useb https://raw.githubusercontent.com/khalilbenaz/claude-skills-collection/main/install.ps1) } dev-log-analyzer -Launch"

🚀 Déjà installé ?

claude "/dev-log-analyzer"

Ou tapez /dev-log-analyzer dans une session Claude Code, ou décrivez simplement votre besoin — le skill se déclenche automatiquement via le skill-router.

🔑 Déclencheurs automatiques

Le skill s'active automatiquement quand votre demande contient :

logsanalyser les logserreur dans les logslog parsingstructured loggingSerilogELKdebug production

📦 Installation manuelle

git clone https://github.com/khalilbenaz/claude-skills-collection.git cp -r claude-skills-collection/skills/dev-log-analyzer ~/.claude/skills/

Payload du plugin : skills/dev-log-analyzer · source éditable : dev-skills/log-analyzer

📖 Manuel

Log Analyzer

Workflow

1. Identifier le format et la source

Avant tout filtrage, qualifier le format :

FormatOutil natifChamp clé à valider
JSON structuréjq, Kibana, Lokitimestamp, level, traceId
Plain text (Apache/Nginx/IIS)grep, awk, goaccesspattern de date, status code
Syslog RFC 5424journalctl, ELK FilebeatPRI, HOSTNAME, MSGID
Windows Event LogGet-WinEvent, WinlogbeatEventID, Provider
Application Insights / DatadogKQL, SDK queryoperation_Id, customDimensions
# Détecter rapidement le format
head -5 app.log | python3 -m json.tool 2>/dev/null || echo "plain text"

2. Filtrer par fenêtre temporelle et correlation ID

Règle d'or : isoler avant d'analyser.

# Plage horaire + niveau ERROR dans un fichier plain text
awk '/2026-06-24T10:[23][0-9]/ && /ERROR/' app.log

# JSON structuré avec jq
jq 'select(.level=="Error" and .timestamp >= "2026-06-24T10:20:00Z")' app.log

# journalctl (systemd)
journalctl -u myservice --since "2026-06-24 10:00" --until "2026-06-24 11:00" -p err

# grep avec correlation ID (format UUID)
grep "traceId=3fa85f64" app.log | sort -t' ' -k1
// Application Insights — top 10 exceptions sur 1h
exceptions
| where timestamp > ago(1h)
| summarize count() by type, outerMessage
| order by count_ desc
| take 10
# Grafana Loki — error rate par service
sum(rate({app="api"} |= "ERROR" [5m])) by (service)

3. Identifier les patterns d'erreurs

Objectifs : top exceptions, spikes, cascading failures.

# Top 10 messages d'erreur (plain text)
grep "ERROR" app.log | sed 's/.*ERROR //' | sort | uniq -c | sort -rn | head 10

# Fréquence d'erreurs par minute (détecter les spikes)
grep "ERROR" app.log | awk '{print $1}' | cut -c1-16 | uniq -c

# Détecter une exception Java/C# récurrente
grep -A 5 "Unhandled exception" app.log | grep "at " | sort | uniq -c | sort -rn

Critères de sévérité :

4. Corréler entre services (distributed tracing)

# Suivre un traceId à travers plusieurs fichiers de services
grep "traceId=abc123" service-a.log service-b.log service-c.log | sort -k1

# Reconstituer la timeline d'une transaction
grep "abc123" *.log | awk '{print $1, $2, $NF}' | sort
// Application Insights — trace complète d'une opération
union requests, dependencies, exceptions, traces
| where operation_Id == "abc123def456"
| order by timestamp asc
| project timestamp, itemType, name, duration, success, message

Si pas de traceId : corréler par userId + fenêtre de ±500 ms, ou par sessionId.

5. Analyser les performances

# Extraire les durées (format "duration=NNNms") et calculer P95
grep "duration=" app.log | grep -oP 'duration=\K[0-9]+' | sort -n | \
  awk 'BEGIN{c=0} {a[c++]=$1} END{print "P50=" a[int(c*0.5)] " P95=" a[int(c*0.95)] " P99=" a[int(c*0.99)]}'

# Identifier les slow SQL queries (EF Core / SqlClient)
grep "Executed DbCommand" app.log | grep -oP '\(\K[0-9]+(?=ms\))' | awk '$1>1000' | wc -l
// Application Insights — P95 latence par endpoint
requests
| where timestamp > ago(1h)
| summarize percentile(duration, 95) by name
| order by percentile_duration_95 desc

6. Structured logging — configuration minimale

Serilog (.NET) :

Log.Logger = new LoggerConfiguration()
    .Enrich.FromLogContext()
    .Enrich.WithProperty("Service", "MyApi")
    .Enrich.WithProperty("Version", "1.4.2")
    .WriteTo.Console(new JsonFormatter())
    .WriteTo.Seq("http://seq:5341")
    .MinimumLevel.Override("Microsoft", LogEventLevel.Warning)
    .CreateLogger();

// Usage — toujours des propriétés structurées, jamais de string interpolation
Log.Warning("Paiement échoué {TransactionId} pour {UserId}", txId, userId);

Winston (Node.js) :

const logger = winston.createLogger({
  format: winston.format.combine(winston.format.timestamp(), winston.format.json()),
  defaultMeta: { service: 'payment-api', version: '2.1.0' },
  transports: [new winston.transports.Console()]
});
logger.error('Payment failed', { transactionId: txId, userId, amount });

7. Centralisation — choix d'infrastructure

StackQuand choisirComplexité
ELK (Elasticsearch + Filebeat + Kibana)Volume > 10 GB/jour, full-text searchHaute
Grafana Loki + PromtailDéjà sur Grafana/Prometheus, volume modéréMoyenne
Application Insights (Azure)App Azure, SDK .NET/Node/PythonFaible
CloudWatch Logs InsightsInfra AWS Lambda/ECS/EC2Faible
SeqDev/staging .NET, budget limitéTrès faible

8. Alertes sur les logs

// Application Insights — alerter si error rate > 1% sur 5 min
requests
| where timestamp > ago(5m)
| summarize failed=countif(success==false), total=count()
| where (failed * 100 / total) > 1
# Grafana Loki alert rule
- alert: HighErrorRate
  expr: sum(rate({app="api"} |= "ERROR" [5m])) > 10
  for: 2m
  annotations:
    summary: "Plus de 10 erreurs/s depuis 2 min"

Garde-fous et anti-patterns

Ne jamais faire :

Pièges courants :

Bonnes pratiques 2026