RGW: Using Lua script to monitor storage class put operations
I have a lua script that read Storageclass header of any put request (as I understand): local function isempty(input) return input == nil or input == '' end if Request.RGWOp == 'put_obj' then RGWDebugLog("Put_Obj with StorageClass: " .. Request.HTTP.StorageClass ) end Then apply the script: radosgw-admin script put --infile=storage_class.lua --context=preRequest Then put an object using boto3: s3.Object(bucket, 'test-object').put(Body="0"*100, ACL='public-read', StorageClass='COLD') But I can't find any log about it in radosgw log? grep -i Lua /var/log/ceph/ceph-client.rgw.ceph1.log Anyone have any ideal? Thanks
Hi, The RGWDebugLog() function is writing debug logs at level 20, so you have to make sure that debug_rgw = 20 Also, if Request.HTTP.StorageClass does not exist in the message (is "nil") the string concat operator would fail, and the script would exit. So, it is probably better to check that in the condition. Yuval On Sun, May 14, 2023 at 10:44 AM <viplanghe6@gmail.com> wrote:
I have a lua script that read Storageclass header of any put request (as I understand): local function isempty(input) return input == nil or input == '' end
if Request.RGWOp == 'put_obj' then RGWDebugLog("Put_Obj with StorageClass: " .. Request.HTTP.StorageClass ) end
Then apply the script: radosgw-admin script put --infile=storage_class.lua --context=preRequest
Then put an object using boto3: s3.Object(bucket, 'test-object').put(Body="0"*100, ACL='public-read', StorageClass='COLD')
But I can't find any log about it in radosgw log? grep -i Lua /var/log/ceph/ceph-client.rgw.ceph1.log
Anyone have any ideal? Thanks _______________________________________________ ceph-users mailing list -- ceph-users@ceph.io To unsubscribe send an email to ceph-users-leave@ceph.io
participants (2)
-
viplanghe6@gmail.com
-
Yuval Lifshitz