Question on fluentd json logging format

Hi,
I have one question.
1 POD with 2 containers (C1, C2)
C1 and C2 have a shared volume and mounted on different paths in the containers.

C1 will write some logs to a file using “command” e.g.
command: [“/bin/sh”, “-c”, " echo I love CNF > /opt/test/t1.txt"]

C2 has to read the content of t1.txt (created by C1) and write it to a file /var/log/t2.txt in a “fluentd Json” log format.

The instruction in the question was to run a yaml file that will generate a configMap for the json and mount it to the C2 container.

Accordingly I ran the yaml and a configmap was created. Then I created a “configMap” volume under C2.

But to generate the output of t1.txt file in a fluentd json format, what needs to be done ?

I did the following in C2 but not sure if its correct:
command: [“/bin/sh”, “-c”, " mnt/t1.txt > /opt/test/t2.txt"] (where mnt/ is the mountPath of sharedvolume of C2).

Thanks
Deb

Hello, @debu3645
You cannot discuss CKAD exam questions here.

Hi @Tej-Singh-Rana
I have updated the question/title.

Your answer is available in this page.

Thanks.

Seems like my approach was correct, however I should also have updated the fluentd file with type set to “json” as below:

data:
  fluentd.conf: |
    <source>
      type json

https://docs.fluentd.org/parser/json