कंटेनरायज्ड अॅप्लिकेशन्सला centralized logging आणि monitoring आवश्यक आहे कारण कंटेनर ephemeral आणि असंख्य असतात — logs आणि metrics बाहेरून संकलित केले पाहिजेत जेणेकरून ते कंटेनर काढून टाकल्यानंतर जगून राहतील आणि संपूर्ण सिस्टीमवर दृश्यमानता प्रदान करतील. हे production containers साठी आवश्यक observability आहे.
Logging: stdout/stderr ला लॉग करा, centrally एकत्रित करा
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
