To enable http access logs for ODM Helm on OpenShift, follow these steps to modify ODM Helm and WebSphere Liberty. This guide is created by Tim Lai with guidance from Mathias Mouly.
Custom shell script
Create a customEnd.sh with the following to replace and add the accessLoggingRef value in the httpEndpoint xml (this step should only be performed by IBM consultants)
#!/bin/bash
sed -i 's|<httpEndpoint|<httpEndpoint accessLoggingRef=\"accessLogging\"|' /config/server.xml
Config Map for the custom shell script
Create a custom ConfigMap pointing to the customEnd.sh. An empty customStart.sh file is still required to be passed
oc create configmap mycustom-scripts-configmap --from-file=customEnd.sh --from-file=customStart.sh
Custom logging yaml file
Create a custom myCustomLogging.yaml file with the following:
<server>
<httpAccessLogging filepath="/logs/http_defaultEndpoint_access.log" id ="accessLogging" logFormat='%h %u %{t}W "%r" %s %b %D %{R}W'/>
<logging hideMessage="SRVE9967 W" traceFileName="stdout" traceFormat="BASIC" traceSpecification="*=audit:org.apache.solr.*=w arning:com.ibm.rules.bdsl.search.solr.*=warning" consoleLogLevel="INFO"/>
</server>
Config Map for the custom logging yaml
Create a custom ConfigMap pointing to the custom logging yaml
oc create configmap mycustom-logging-configmap --from-file=myCustomLogging.yaml
Set references to the Config Maps in the ODM Helm values.yaml
In the ODM Helm values.yaml file, specify your custom loggingRef and customScriptsRef ConfigMaps
decisionCenter:
enabled: true
tagOrDigest:
persistenceLocale: en_US
replicaCount: 1
customlibPvc: my-custom-dc-libs-pvc
loggingRef: mycustom-logging-configmap
jvmOptionsRef:
webConfigRef:
extendRoleMapping: false
disableAllAuthenticatedUser: false
customScriptsRef: mycustom-scripts-configmap
Redeploy or restart the Decision Center Pods
Restart the Decision Center pods.
When the pods are up, click on the Terminal tab for the pod, you should see the /logs/http_defaultEndpoint_access.log created
http_defaultEndpoint_access.log will contain the following entries:
For reference and troubleshooting, scripts such as the customEnd.sh should be in the Decision Center pod’s /script folder
WebSphere Liberty http access logging parameters
The available log format options for WebSphere Liberty are documented here: https://openliberty.io/docs/latest/access-logging.html