Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in command log-analytics storage purge-storage-data #818

Open
kk-hiraskar opened this issue Jun 24, 2024 · 8 comments
Open

Error in command log-analytics storage purge-storage-data #818

kk-hiraskar opened this issue Jun 24, 2024 · 8 comments
Labels
Logging Analytics Issue pertains to the Logging Analytics

Comments

@kk-hiraskar
Copy link

kk-hiraskar commented Jun 24, 2024

I am purging logs using OCI CLI

oci log-analytics storage purge-storage-data     --compartment-id "$MONITORING_COMPARTMENT_OCID"    \
 --namespace-name "$TENANCY_NAME"     --purge-query-string "\"log group\"=\"${STACK_NAME}\""     \
 --time-data-ended "$(date +%Y-%m-%d -d '+1 day')"     --wait-for-state SUCCEEDED --wait-for-state FAILED \
 --wait-interval-seconds 10

This is purging logs, I can confirm it from web console, but however this command return error as,

Action completed. Waiting until the work request has entered state: ('SUCCEEDED', 'FAILED')
Encountered error while waiting for work request to enter the specified state. Outputting last known resource state
{
  "opc-work-request-id": "ocid1.loganalyticsstorageworkrequest.oc1.phx.amaaaaaaxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxwzndq"
}
TypeError: get_storage_work_request() missing 1 required positional argument: 'namespace_name'

due to this error, seems command is not waiting until mentioned logs are purged.
And early exiting with error.
However purge is happening.


I have verified namespace is provided correctly --namespace-name "$TENANCY_NAME"
& this variable will not be blank, it is holding tenancy name, which is also same as object storage namespace.


This is web console, where purge requests are showing success.. and logs are purged also as per the query submitted.
image

@kk-hiraskar
Copy link
Author

is it a problem with?
option is --namespace-name and inside code it is assigning with just -ns or --namespace

get_param(loganalytics_cli.query, 'namespace_name').opts.extend(['--namespace', '-ns'])

@karthik-k-kamath karthik-k-kamath added the Logging Analytics Issue pertains to the Logging Analytics label Jul 12, 2024
@karthik-k-kamath
Copy link
Member

karthik-k-kamath commented Jul 12, 2024

Hi Karthik, thanks for raising.
This looks like a Service error, because opc-work-request-id has been generated.
So needs to be checked with service team: Logging Analytics
We will internally followup

Thanks!

@kk-hiraskar
Copy link
Author

thanks @karthik-k-kamath
ya.. work-request is generated, and work is also happening..
however it is failing at waiting stage for expected states..
and exiting from command with error status, much earlier than work is actually completed.

@kk-hiraskar
Copy link
Author

Today spent some time to fix the issue.
and got the problem..

This line need to be corrected, namespace_name should also be passed as parameter to get_storage_work_request call.

result = oci.wait_until(client, client.get_storage_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs)

after changing this line as:

result = oci.wait_until(client, client.get_storage_work_request(result.headers['opc-work-request-id'], namespace_name), 'status', wait_for_state, **wait_period_kwargs)

working all fine. it is now waiting for status, and exiting clean without any issues.

@kk-hiraskar
Copy link
Author

I have given a fix also..
please somebody can release the fix please??

@karthik-k-kamath
Copy link
Member

Hi KK did you reach the service team? Logging Analytics
The fix has to come from them

@kk-hiraskar
Copy link
Author

Hi @karthik-k-kamath
Yes I reached on channel as you suggested, no response from Logging Analytics service team..

@kk-hiraskar
Copy link
Author

kk-hiraskar commented Aug 28, 2024

As of now work around I gave 2.5 minutes wait time..
But yesterday saw again issue where seems that time is not sufficient..
so now I am increasing to safer 10 minutes..
but this kind of manual wait times adding not suggestible.. and user can complain for long gap every time..

--
if their is any alternative call which can say us if the job completed.. I can add that way also..
but this simple fix suggested above can solve it easily..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Logging Analytics Issue pertains to the Logging Analytics
Projects
None yet
Development

No branches or pull requests

2 participants