|
| 1 | +// Module included in the following assemblies: |
| 2 | +// |
| 3 | +// * networking/ptp/configuring-ptp.adoc |
| 4 | + |
| 5 | +:_mod-docs-content-type: PROCEDURE |
| 6 | +[id="cnf-configuring-enhanced-log-reduction-for-linuxptp_{context}"] |
| 7 | += Configuring enhanced PTP log reduction |
| 8 | + |
| 9 | +Basic log reduction effectively filters out frequent logs. However, if you want a periodic summary of the filtered logs, use the enhanced log reduction feature. |
| 10 | + |
| 11 | +.Prerequisites |
| 12 | + |
| 13 | +* Install the OpenShift CLI (`oc`). |
| 14 | +
|
| 15 | +* Log in as a user with `cluster-admin` privileges. |
| 16 | +
|
| 17 | +* Install the PTP Operator. |
| 18 | +
|
| 19 | +.Procedure |
| 20 | + |
| 21 | +. Edit the `PtpConfig` custom resource (CR): |
| 22 | ++ |
| 23 | +[source,terminal] |
| 24 | +---- |
| 25 | +$ oc edit PtpConfig -n openshift-ptp |
| 26 | +---- |
| 27 | + |
| 28 | +. Add the `ptpSettings.logReduce` specification in the `spec.profile` section, and set the value to `enhanced`: |
| 29 | ++ |
| 30 | +[source,yaml] |
| 31 | +---- |
| 32 | +apiVersion: ptp.openshift.io/v1 |
| 33 | +kind: PtpConfig |
| 34 | +metadata: |
| 35 | + name: <ptp_config_name> |
| 36 | + namespace: openshift-ptp |
| 37 | +... |
| 38 | +spec: |
| 39 | + profile: |
| 40 | + - name: "profile1" |
| 41 | +... |
| 42 | + ptpSettings: |
| 43 | + logReduce: "enhanced" |
| 44 | +---- |
| 45 | + |
| 46 | +. Optional: Configure the interval for summary logs and a threshold in nanoseconds for the master offset logs. For example, to set the interval to 60 seconds and the threshold to 100 nanoseconds, add the `ptpSettings.logReduce` specification in the `spec.profile` section and set the value to `enhanced 60s 100`. |
| 47 | ++ |
| 48 | +[source,yaml] |
| 49 | +---- |
| 50 | +apiVersion: ptp.openshift.io/v1 |
| 51 | +kind: PtpConfig |
| 52 | +metadata: |
| 53 | + name: <ptp_config_name> |
| 54 | + namespace: openshift-ptp |
| 55 | +spec: |
| 56 | + profile: |
| 57 | + - name: "profile1" |
| 58 | + ptpSettings: |
| 59 | + logReduce: "enhanced 60s 100" <1> |
| 60 | +---- |
| 61 | ++ |
| 62 | +<1> By default, the `linuxptp-daemon` is configured to generate summary logs every 30 seconds if no value is specified. In the example configuration, the daemon generates summary logs every 60 seconds and a threshold of 100 nanoseconds for the master offset logs is set. This means the daemon only produces summary logs at the specified interval. However, if your clock's offset from the master exceeds plus or minus 100 nanoseconds, that specific log entry is recorded. |
| 63 | + |
| 64 | +. Optional: To set the interval without a master offset threshold, configure the `logReduce` field to `enhanced 60s` in the YAML. |
| 65 | ++ |
| 66 | +[source,yaml] |
| 67 | +---- |
| 68 | +apiVersion: ptp.openshift.io/v1 |
| 69 | +kind: PtpConfig |
| 70 | +metadata: |
| 71 | + name: <ptp_config_name> |
| 72 | + namespace: openshift-ptp |
| 73 | +spec: |
| 74 | + profile: |
| 75 | + - name: "profile1" |
| 76 | + ptpSettings: |
| 77 | + logReduce: "enhanced 60s" |
| 78 | +---- |
| 79 | + |
| 80 | +. Save and exit to apply the changes to the `PtpConfig` CR. |
| 81 | + |
| 82 | +.Verification |
| 83 | + |
| 84 | +. Get the name of the `linuxptp-daemon` pod and the corresponding node where the `PtpConfig` CR is applied by running the following command |
| 85 | ++ |
| 86 | +[source,terminal] |
| 87 | +---- |
| 88 | +$ oc get pods -n openshift-ptp -o wide |
| 89 | +---- |
| 90 | ++ |
| 91 | +.Example output |
| 92 | +[source,terminal] |
| 93 | +---- |
| 94 | +NAME READY STATUS RESTARTS AGE IP NODE |
| 95 | +linuxptp-daemon-gmv2n 3/3 Running 0 1d17h 10.1.196.24 compute-0.example.com |
| 96 | +linuxptp-daemon-lgm55 3/3 Running 0 1d17h 10.1.196.25 compute-1.example.com |
| 97 | +ptp-operator-3r4dcvf7f4-zndk7 1/1 Running 0 1d7h 10.129.0.61 control-plane-1.example.com |
| 98 | +---- |
| 99 | + |
| 100 | +. Verify that master offset messages are excluded from the logs by running the following command: |
| 101 | ++ |
| 102 | +[source,terminal] |
| 103 | +---- |
| 104 | +$ oc -n openshift-ptp logs <linux_daemon_container> -c linuxptp-daemon-container | grep "master offset" <1> |
| 105 | +---- |
| 106 | +<1> <linux_daemon_container> is the name of the `linuxptp-daemon` pod, for example, `linuxptp-daemon-gmv2n`. |
| 107 | + |
0 commit comments