Skip to content

Commit 20497d6

Browse files
authored
Add MEKO log information (#1492)
1 parent 1c978e3 commit 20497d6

File tree

1 file changed

+68
-5
lines changed

1 file changed

+68
-5
lines changed

source/reference/troubleshooting.txt

Lines changed: 68 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,32 @@ Review the Logs
159159
---------------
160160

161161
Keep and review adequate logs to help debug issues and monitor cluster
162-
activity. Use the recommended `logging architecture <https://kubernetes.io/docs/concepts/cluster-administration/logging/>`__ to retain
163-
|k8s-pod| logs even after a Pod is deleted.
162+
activity. Use the recommended `logging architecture
163+
<https://kubernetes.io/docs/concepts/cluster-administration/logging/>`__
164+
to retain |k8s-pod| logs even after a Pod is deleted.
165+
166+
Logging Process
167+
~~~~~~~~~~~~~~~
168+
169+
The |k8s-op-short| writes to the Pod logs by using
170+
a wrapper that converts logs from the {+mdbagent+} and |mongod|
171+
components on the database deployment Pod into a
172+
structured logging entry in the following |json| format:
173+
174+
.. code-block:: json
175+
176+
{ "logType": "<log-type>", "contents": "<log line from a log file>" }
177+
178+
The |k8s-op-short| supports the following log types:
179+
180+
- ``automation-agent-verbose``
181+
- ``automation-agent-stderr``
182+
- ``mongodb``
183+
- ``mongodb-audit``
184+
185+
When you read logs from a database container,
186+
the |k8s-op-short| returns the structured |json| entry
187+
that contains logs from different sources.
164188

165189
.. _review-k8s-op-logs:
166190

@@ -193,8 +217,8 @@ To find which pods are available, invoke this command first:
193217
.. _review-all-k8s-logs:
194218
.. _review-one-k8s-pod:
195219

196-
Review Logs from Specific Pod
197-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
220+
Review Logs from a Specific Pod
221+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
198222

199223
If you want to narrow your review to a specific |k8s-pod|, you can
200224
invoke this command:
@@ -214,6 +238,45 @@ invoke this command:
214238
This returns the :ref:`Automation Agent Log <agent-logs>` for this
215239
replica set.
216240

241+
Review a Specific Log
242+
~~~~~~~~~~~~~~~~~~~~~
243+
244+
You can narrow your review to a specific log type. For example,
245+
the following command returns audit logs from the |k8s| logs
246+
of the specified Pod by specifying the ``mongodb-audit`` log type:
247+
248+
.. code-block:: sh
249+
250+
kubectl logs -c mongodb-enterprise-database replica-set-0 | jq -r 'select(.logType == "mongodb-audit") | .contents'
251+
252+
The command returns an entry similar to the following output:
253+
254+
.. code-block:: json
255+
256+
{{{ "atype":"startup","ts":{"$date":"2023-08-30T20:43:54.649+00:00"},"uuid":{"$binary":"oDcPEY69R1yiUtpMupaXOQ==","$type":"04"},"local":{"isSystemUser":true},"remote":{"isSystemUser":true},"users":[],"roles":[],"param":{"options":{"auditLog":{"destination":"file","format":"JSON","path":"/var/log/mongodb-mms-automation/mongodb-audit.log"},"config":"/data/automation-mongod.conf","net":{"bindIp":"0.0.0.0","port":27017,"tls":{"mode":"disabled"}},"processManagement":{"fork":true},"replication":{"replSetName":"replica-set"},"storage":{"dbPath":"/data","engine":"wiredTiger"},"systemLog":{"destination":"file","path":"/var/log/mongodb-mms-automation/mongodb.log"}}},"result":0}
257+
{"atype":"startup","ts":{"$date":"2023-08-30T20:44:05.466+00:00"},"uuid":{"$binary":"OUbUWC1DQM6k/Ih4hKZq4g==","$type":"04"},"local":{"isSystemUser":true},"remote":{"isSystemUser":true},"users":[],"roles":[],"param":{"options":{"auditLog":{"destination":"file","format":"JSON","path":"/var/log/mongodb-mms-automation/mongodb-audit.log"},"config":"/data/automation-mongod.conf","net":{"bindIp":"0.0.0.0","port":27017,"tls":{"mode":"disabled"}},"processManagement":{"fork":true},"replication":{"replSetName":"replica-set"},"storage":{"dbPath":"/data","engine":"wiredTiger"},"systemLog":{"destination":"file","path":"/var/log/mongodb-mms-automation/mongodb.log"}}},"result":0}}}
258+
259+
Audit Logs
260+
~~~~~~~~~~
261+
262+
If you want audit logs to display in the |k8s| Pod's logs, configure
263+
your resource definition to save audit logs to the
264+
``/var/log/mongodb-mms-automation/mongodb-audit.log`` path:
265+
266+
.. code-block:: yaml
267+
268+
spec:
269+
additionalMongodConfig:
270+
auditLog:
271+
destination: file
272+
format: JSON
273+
path: /var/log/mongodb-mms-automation/mongodb-audit.log
274+
275+
.. note::
276+
277+
This file path is fixed. You can't specify a different path to
278+
save audit logs.
279+
217280
.. _k8s-validation-webhook:
218281

219282
Check Messages from the Validation Webhook
@@ -693,7 +756,7 @@ commands. This requires you to prevent the container from restarting.
693756

694757
kubectl exec -it <pod-name> bash
695758

696-
Verify Corrrectness of Domain Names in TLS Certificates
759+
Verify Correctness of Domain Names in TLS Certificates
697760
-------------------------------------------------------
698761

699762
A MongoDB replica set or sharded cluster may fail to reach

0 commit comments

Comments
 (0)