ਕੰਟੇਨਰਾਈਜ਼ਡ ਐਪਲੀਕੇਸ਼ਨਾਂ ਨੂੰ ਕੇਂਦਰੀਕਰਤ ਲਾਗਿੰਗ ਅਤੇ ਮਾਨਟਰਿੰਗ ਦੀ ਜ਼ਰੂਰਤ ਹੈ ਕਿਉਂਕਿ ਕੰਟੇਨਰ ਅਸਥਾਈ ਅਤੇ ਬਹੁਤ ਸਾਰੇ ਹਨ — ਲਾਗਸ ਅਤੇ metrics ਨੂੰ ਬਾਹਰੀ ਤੌਰ 'ਤੇ ਇਕੱਠਾ ਕਰਨਾ ਚਾਹੀਦਾ ਹੈ ਤਾਂ ਜੋ ਉਹ ਕੰਟੇਨਰ ਹਟਾਉਣ ਤੋਂ ਬਾਅਦ ਵੀ ਬਚੇ ਰਹਣ ਅਤੇ ਪੂਰੇ ਸਿਸਟਮ ਵਿੱਚ visibility ਪ੍ਰਦਾਨ ਕਰਣ। ਇਹ ਪ੍ਰੋਡਕਸ਼ਨ ਕੰਟੇਨਰਾਂ ਲਈ ਜ਼ਰੂਰੀ observability ਹੈ।
ਲਾਗਿੰਗ: 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
