veza/verify_logs_setup.sh

79 lines
1.9 KiB
Bash
Executable file
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# Script de vérification de la configuration des logs Veza
echo "🔍 Vérification de la configuration des logs Veza"
echo "=================================================="
echo ""
LOG_DIR="${LOG_DIR:-/var/log/veza}"
# Liste des fichiers attendus
declare -a FILES=(
"backend-api.log"
"backend-api-error.log"
"frontend.log"
"frontend-error.log"
"chat.log"
"chat-error.log"
"stream.log"
"stream-error.log"
"db.log"
"db-error.log"
"redis.log"
"redis-error.log"
"rabbitmq.log"
"rabbitmq-error.log"
)
echo "📁 Répertoire de logs : $LOG_DIR"
echo ""
# Vérifier le répertoire
if [ ! -d "$LOG_DIR" ]; then
echo "❌ Répertoire $LOG_DIR n'existe pas"
echo " Création avec : sudo mkdir -p $LOG_DIR && sudo chown -R \$USER:\$USER $LOG_DIR"
exit 1
else
echo "✅ Répertoire $LOG_DIR existe"
fi
# Vérifier les permissions
if [ ! -w "$LOG_DIR" ]; then
echo "⚠️ Pas de permission d'écriture sur $LOG_DIR"
echo " Correction avec : sudo chown -R \$USER:\$USER $LOG_DIR"
else
echo "✅ Permissions d'écriture OK"
fi
echo ""
echo "📄 Fichiers de logs :"
echo ""
# Vérifier chaque fichier
MISSING=0
for file in "${FILES[@]}"; do
if [ -f "$LOG_DIR/$file" ]; then
SIZE=$(ls -lh "$LOG_DIR/$file" | awk '{print $5}')
echo "$file ($SIZE)"
else
echo "$file (sera créé au démarrage)"
MISSING=$((MISSING + 1))
fi
done
echo ""
if [ $MISSING -eq 0 ]; then
echo "✅ Tous les fichiers sont présents ou seront créés au démarrage"
else
echo " $MISSING fichier(s) seront créés au démarrage des services"
fi
echo ""
echo "📊 Statistiques :"
if [ -d "$LOG_DIR" ]; then
TOTAL_SIZE=$(du -sh "$LOG_DIR" 2>/dev/null | awk '{print $1}')
FILE_COUNT=$(find "$LOG_DIR" -name "*.log" -type f 2>/dev/null | wc -l)
echo " Taille totale : $TOTAL_SIZE"
echo " Nombre de fichiers : $FILE_COUNT"
fi