Complete the code to specify the logging driver for a Docker container.
docker run --log-driver=[1] nginxThe json-file driver is the default logging driver for Docker containers, storing logs as JSON files on the host.
Complete the command to view logs of a Kubernetes pod named 'webapp'.
kubectl logs [1]The kubectl logs command requires the pod name, so pod/webapp is correct.
Fix the error in the Fluentd configuration snippet to collect container logs from the correct path.
<source>
@type tail
path [1]
pos_file /var/log/fluentd-containers.log.pos
tag kubernetes.*
format json
</source>Fluentd collects container logs from /var/log/containers/*.log in Kubernetes environments.
Fill both blanks to create a Kubernetes DaemonSet manifest snippet that deploys a logging agent on all nodes.
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: fluentd
spec:
selector:
matchLabels:
name: fluentd
template:
metadata:
labels:
name: fluentd
spec:
containers:
- name: fluentd
image: fluentd:latest
volumeMounts:
- name: varlog
mountPath: [1]
volumes:
- name: varlog
hostPath:
path: [2]The logging agent mounts /var/log inside the container and maps it to /var/log on the host to access container logs.
Fill all three blanks to define a Kubernetes ConfigMap for Fluentd with a filter to add Kubernetes metadata.
apiVersion: v1
kind: ConfigMap
metadata:
name: fluentd-config
data:
fluent.conf: |
<filter kubernetes.**>
@type [1]
kubernetes_url [2]
cache_size [3]
</filter>The filter type is kubernetes_metadata to enrich logs with Kubernetes info. The URL points to the Kubernetes API server, and cache_size controls metadata caching.