-2

I tried the following command:

gcloud logging logs delete

but it is asking log name

ERROR: (gcloud.logging.logs.delete) argument LOG_NAME: Must be specified.

I want to get all the logs to be deleted which are default.

Rogelio Monter
  • 1,084
  • 7
  • 18
pritampanhale
  • 106
  • 10

1 Answers1

6

Your question would benefit from showing some attempt to solve this problem for yourself.

See gcloud logging logs delete

It requires a LOG_NAME as provided by e.g. gcloud logging logs list.

Since logs list returns a simple list of logs if you wanted to delete existing (!) log entries for all logs in a specific project, you could:

Use the following at your own risk
it will irrecoverably delete every existing log entry in every log in the current project

PROJECT="[[YOUR-PROJECT]]"

LOGS=$(\
  gcloud logging log list \
  --project=${PROJECT}

for LOG in ${LOGS}
do
  gcloud logging logs delete ${LOG} \
  --project=${PROJECT} \
  --quiet
done
DazWilkin
  • 32,823
  • 5
  • 47
  • 88