|
| 1 | +// Module included in the following assemblies: |
| 2 | +// |
| 3 | +// * networking/using-ptp.adoc |
| 4 | + |
| 5 | +:_content-type: PROCEDURE |
| 6 | +[id="cnf-configuring-log-filtering-for-linuxptp_{context}"] |
| 7 | += Configuring log filtering for linuxptp services |
| 8 | + |
| 9 | +The `linuxptp` daemon generates logs that you can use for debugging purposes. In telco or other deployment configurations that feature a limited storage capacity, these logs can add to the storage demand. |
| 10 | + |
| 11 | +To reduce the number log messages, you can configure the `PtpConfig` custom resource (CR) to exclude log messages that report the `master offset` value. The `master offset` log message reports the difference between the current node's clock and the master clock in nanoseconds. |
| 12 | + |
| 13 | +.Prerequisites |
| 14 | +* Install the OpenShift CLI (`oc`). |
| 15 | +
|
| 16 | +* Log in as a user with `cluster-admin` privileges. |
| 17 | +
|
| 18 | +* Install the PTP Operator. |
| 19 | +
|
| 20 | +.Procedure |
| 21 | + |
| 22 | +. Edit the `PtpConfig` CR: |
| 23 | ++ |
| 24 | +[source,terminal] |
| 25 | +---- |
| 26 | +$ oc edit PtpConfig -n openshift-ptp |
| 27 | +---- |
| 28 | + |
| 29 | +. In `spec.profile`, add the `ptpSettings.logReduce` specification and set the value to `true`: |
| 30 | ++ |
| 31 | +[source,yaml] |
| 32 | +---- |
| 33 | +apiVersion: ptp.openshift.io/v1 |
| 34 | +kind: PtpConfig |
| 35 | +metadata: |
| 36 | + name: <ptp_config_name> |
| 37 | + namespace: openshift-ptp |
| 38 | +... |
| 39 | +spec: |
| 40 | + profile: |
| 41 | + - name: "profile1" |
| 42 | +... |
| 43 | + ptpSettings: |
| 44 | + logReduce: "true" |
| 45 | +---- |
| 46 | ++ |
| 47 | +[NOTE] |
| 48 | +==== |
| 49 | +For debugging purposes, you can revert this specification to `False` to include the master offset messages. |
| 50 | +==== |
| 51 | + |
| 52 | +. Save and exit to apply the changes to the `PtpConfig` CR. |
| 53 | + |
| 54 | +.Verification |
| 55 | + |
| 56 | +. Get the name of the `linuxptp-daemon` pod and corresponding node where the `PtpConfig` CR has been applied: |
| 57 | ++ |
| 58 | +[source,terminal] |
| 59 | +---- |
| 60 | +$ oc get pods -n openshift-ptp -o wide |
| 61 | +---- |
| 62 | ++ |
| 63 | +.Example output |
| 64 | +[source,terminal] |
| 65 | +---- |
| 66 | +NAME READY STATUS RESTARTS AGE IP NODE |
| 67 | +linuxptp-daemon-gmv2n 3/3 Running 0 1d17h 10.1.196.24 compute-0.example.com |
| 68 | +linuxptp-daemon-lgm55 3/3 Running 0 1d17h 10.1.196.25 compute-1.example.com |
| 69 | +ptp-operator-3r4dcvf7f4-zndk7 1/1 Running 0 1d7h 10.129.0.61 control-plane-1.example.com |
| 70 | +---- |
| 71 | + |
| 72 | +. Verify that master offset messages are excluded from the logs by running the following command: |
| 73 | ++ |
| 74 | +[source,terminal] |
| 75 | +---- |
| 76 | +$ oc -n openshift-ptp logs <linux_daemon_container> -c linuxptp-daemon-container | grep "master offset" <1> |
| 77 | +---- |
| 78 | +<1> <linux_daemon_container> is the name of the `linuxptp-daemon` pod, for example `linuxptp-daemon-gmv2n`. |
| 79 | ++ |
| 80 | +When you configure the `logReduce` specification, this command does not report any instances of `master offset` in the logs of the `linuxptp` daemon. |
0 commit comments