#!/bin/bash # Define the services we are interested in SERVICES=( "api-gateway" "report-generator-service" "data-persistence-service" "alphavantage-provider-service" "tushare-provider-service" "finnhub-provider-service" "yfinance-provider-service" "workflow-orchestrator-service" "fundamental_analysis-nats-1" ) # Get line count from first argument, default to 10 LINES_INPUT=${1:-10} echo "========================================================" echo " FUNDAMENTAL ANALYSIS SYSTEM STATUS REPORT " echo "========================================================" echo "Showing last $LINES_INPUT lines of logs per service" echo "" for service in "${SERVICES[@]}"; do echo "--------------------------------------------------------" echo ">>> SERVICE: $service" echo "--------------------------------------------------------" if docker ps -a --format '{{.Names}}' | grep -q "^${service}$"; then STATUS=$(docker inspect --format='{{.State.Status}}' "$service") echo "Status: $STATUS" echo "Logs (Last $LINES_INPUT lines):" echo "" # Execute docker logs directly without extra piping that might buffer output weirdly in some shells, though unlikely. # The issue might be how variables are expanded or env. # Using simple variable expansion. docker logs "$service" --tail $LINES_INPUT 2>&1 else echo "Status: NOT FOUND / NOT RUNNING" fi echo "" echo "" done echo "========================================================" echo " END OF LOG REPORT " echo "========================================================"