కంటైనరైజ్డ్ అప్లికేషన్లకు కేంద్రీకృత లాగింగ్ మరియు మానిటరింగ్ అవసరం ఎందుకంటే కంటైనర్లు ক్షణికమైనవి మరియు అసంఖ్యాకమైనవి — లాగ్లు మరియు మెట్రిక్లను బాహ్యంగా సংগ్రహించాలి తీయాలి కంటేనర్ తీసివేయడం నుండి రక్షించడానికి మరియు మొత్తం సిస్టమ్లో దృశ్యమానత ఇవ్వడానికి. ఇది ఉత్పత్తి కంటైనర్ల కోసం అవసరమైన పర్యవేక్షణ.
లాగింగ్: stdout/stderr కు లాగ్ చేయండి, కేంద్రంగా సమ్మిళితం చేయండి
BEST PRACTICE: containers should log to STDOUT/STDERR (not to files inside the container):
→ Docker captures these (`docker logs`); a logging DRIVER forwards them elsewhere
→ WHY: containers are EPHEMERAL — logs in a removed container are LOST. Centralize them.
Logging drivers / pipelines forward logs to a central system:
→ json-file (default), syslog, fluentd, awslogs, gelf, etc. (--log-driver)
→ Aggregation stacks: ELK/Elastic (Elasticsearch+Logstash+Kibana), Loki+Grafana,
cloud logging (CloudWatch, Stackdriver), Datadog, etc.
→ Centralized logs: searchable, persistent, span ALL containers/hosts → real visibility
