Viewing change logs for Wired
When you configure virtual infrastructure in the Wired portal, the low-level details of your changes are written to change logs. You can view these logs in the Red Hat® OpenShift® CLI or the Kibana application.
Log fields
When you create, update, or delete an object in the portal, a message is created in the pod logs
that contains these fields:
Field | Description |
---|---|
AuditEvent | A hardcoded string that identifies the Wired portal as the source of the log message. |
timestamp |
The date and time of the change. |
principal |
The user that requests the change. |
type |
The type of event that causes the message to be created, for example, HTTP_REQUEST. |
Action Taken |
The action that the user takes, for example, CREATE. |
Comment |
Information about the source or purpose of the change, for example, API call. |
Tenant Id |
The ID of the Wired customer group that the user belongs to. |
Request Uri |
A unique identifier that indicates the source of the change, for example, /api/v1/cloudProviderAccounts. |
RemoteIpAddr |
The user's IP address. |
authorities |
The Cloud Pak tenant ID that the user's security group belongs to. This ID is used when the change is saved in Site Planner. |
Viewing the logs in the Red Hat OpenShift CLI
To view the logs in the Red Hat OpenShift CLI, complete the following steps:
- If application logging is not enabled for the Wired portal, enable it by completing the
following substeps:
- Edit the Wired CR by running this
command:
oc edit cp4nawired cp4nawired-default -n <namespace>
<namespace> is the namespace where the Wired portal is installed.
- Set the
mcnpEnableAuditLog
attribute to true. - Configure the logging level by setting the
mcnpLogLevel
attribute. The following levels are supported:INFO
DEBUG
INFO
. When the level is set toDEBUG
, more detailed information is written to the logs. - Save your changes.
- Edit the Wired CR by running this
command:
- Get the names of the Wired pods, that is, the
mcnp
pods, by running this command:oc get pods -n <namespace> | grep -i mcnp
- If you enabled application logging in step 1, restart the
mcnp
pods by running this command for each pod:oc delete pod -n <namespace> <mcnp_pod_name>
<mcnp_pod_name> is the name of the
mcnp
pod.The pods restart automatically.
- View the logs in each
mcnp
pod by running this command:oc logs -f <mcnp_pod_name> | grep "AuditEvent"
<mcnp_pod_name> is the name of the
mcnp
pod.
Viewing the logs in Kibana
Ensure that Red Hat OpenShift Logging is installed on the same cluster where Wired is installed. For more information, see Application logging with EFK.
Procedure
- If the Wired logging integration with Kibana is not enabled, enable it by completing the
following substeps:
- Edit the Wired CR by running this
command:
oc edit cp4nawired cp4nawired-default -n <namespace>
- Set the
mcnpEnableKibanaLogging
attribute to true. - Set the
mcnpKibanaLoggingEndpoint
attribute to the URL of the Kibana application. For more information about how to retrieve this URL, see steps 1-7 of Updating the Kibana URL for the Nimrod UI. - Set the
mcnpKibanaLoggingIndex
attribute to the index pattern that you want to use to retrieve Wired logs in Kibana, for example, wired-logs. - Save your changes.
- Get the names of the Wired pods, that is, the
mcnp
pods, by running this command:oc get pods -n <namespace> | grep -i mcnp
- Restart the
mcnp
pods by running this command for each pod:oc delete pod -n <namespace> <mcnp_pod_name>
<mcnp_pod_name> is the name of the
mcnp
pod.The pods restart automatically.
- Edit the Wired CR by running this
command:
- Retrieve your Kibana login credentials.
- Retrieve your Kibana username by running this
command:
oc -n <cp4na_namespace> get secret platform-auth-idp-credentials -o jsonpath='{.data.admin_username}' | base64 --decode
- Retrieve your Kibana password by running this
command:
oc -n <cp4na_namespace> get secret platform-auth-idp-credentials -o jsonpath='{.data.admin_password}' | base64 --decode
<cp4na_namespace> is the namespace where IBM Cloud Pak for Network Automation is installed.
- Retrieve your Kibana username by running this
command:
- Connect to the Kibana UI.
- Copy the URL that you configured in the
mcnpKibanaLoggingEndpoint
CR attribute to a browser window. - Enter the login credentials that you retrieved in step 2.
- Copy the URL that you configured in the
- In the Kibana dashboard, view the Wired logs by setting the default index pattern to the value
that you configured in the
mcnpKibanaLoggingIndex
CR attribute, for example, wired-logs.