cloud-provider-openstack icon indicating copy to clipboard operation
cloud-provider-openstack copied to clipboard

[cinder-csi-plugin] implement structured logging

Open sergelogvinov opened this issue 1 year ago • 9 comments

What this PR does / why we need it:

implement structured logging KEP 1602

CSI plugins often use common values like node name, volume name, volume ID, and instance ID in unstructured error and log messages. This makes it hard to group and sort them. I want to change these logs to structured logs, as the core Kubernetes team has decided to move in this direction

Current logs:

CreateVolume: Successfully created volume 47d323fd-b06c-424e-b27b-d27db2fb2c5c in Availability Zone: nova of size 10 GiB

Structured logs

"Successfully created volume" func="CreateVolume" volumeID="228d4464-48a2-4a45-81a7-24d3d0a1862a" size=10 zone="nova"
"Successfully detached volume" func="ControllerUnpublishVolume" volumeID="228d4464-48a2-4a45-81a7-24d3d0a1862a" instanceID="89e33913-0cce-4c1a-be2f-4e6a39d32b51"
"Successfully deleted volume" func="DeleteVolume" volumeID="228d4464-48a2-4a45-81a7-24d3d0a1862a" cloud=""

Default log keys:

  • func- name of function, example CreateVolume
  • size - volume size
  • volume - volume name
  • volumeID - volume ID
  • snapshotID - snapshot ID
  • instanceID - instance ID
  • zone - availability zone
  • cloud - cloud config

Which issue this PR fixes(if applicable):

make sense after #2640

Special notes for reviewers:

Release note:

NONE

sergelogvinov avatar Sep 17 '24 05:09 sergelogvinov