codenuk_backend_mine/scripts/setup/logs.sh
2025-10-10 08:56:39 +05:30

41 lines
1.0 KiB
Bash
Executable File

#!/bin/bash
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
echo -e "${BLUE}📜 Pipeline Logs Viewer${NC}"
echo "======================"
if [ $# -eq 0 ]; then
echo -e "${BLUE}Available services:${NC}"
echo " - postgres"
echo " - redis"
echo " - mongodb"
echo " - rabbitmq"
echo " - all (shows all services)"
echo ""
echo -e "${BLUE}Usage:${NC} $0 [service-name] [lines]"
echo -e "${BLUE}Example:${NC} $0 postgres 50"
echo -e "${BLUE}Example:${NC} $0 all"
exit 1
fi
SERVICE=$1
LINES=${2:-100}
if [ "$SERVICE" == "all" ]; then
echo -e "${BLUE}📋 Showing logs for all services (last $LINES lines each):${NC}"
for service in postgres redis mongodb rabbitmq; do
echo ""
echo -e "${YELLOW}=== $service ===${NC}"
docker-compose logs --tail=$LINES $service
done
else
echo -e "${BLUE}📋 Showing logs for $SERVICE (last $LINES lines):${NC}"
docker-compose logs --tail=$LINES --follow $SERVICE
fi