Borra un receptor
Organiza tus páginas con colecciones
Guarda y categoriza el contenido según tus preferencias.
Demuestra cómo borrar un receptor de Cloud Logging.
Muestra de código
Salvo que se indique lo contrario, el contenido de esta página está sujeto a la licencia Atribución 4.0 de Creative Commons, y los ejemplos de código están sujetos a la licencia Apache 2.0. Para obtener más información, consulta las políticas del sitio de Google Developers. Java es una marca registrada de Oracle o sus afiliados.
[[["Fácil de comprender","easyToUnderstand","thumb-up"],["Resolvió mi problema","solvedMyProblem","thumb-up"],["Otro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Información o código de muestra incorrectos","incorrectInformationOrSampleCode","thumb-down"],["Faltan la información o los ejemplos que necesito","missingTheInformationSamplesINeed","thumb-down"],["Problema de traducción","translationIssue","thumb-down"],["Otro","otherDown","thumb-down"]],[],[],[],null,["# Delete a sink\n\nDemonstrates how to delete a Cloud Logging Sink.\n\nCode sample\n-----------\n\n### C#\n\n\nTo learn how to install and use the client library for Logging, see\n[Logging client libraries](/logging/docs/reference/libraries).\n\n\nTo authenticate to Logging, set up Application Default Credentials.\nFor more information, see\n\n[Set up authentication for a local development environment](/docs/authentication/set-up-adc-local-dev-environment).\n\n private void DeleteSink(string sinkId)\n {\n var sinkClient = ConfigServiceV2Client.Create();\n LogSinkName sinkName = new LogSinkName(s_projectId, sinkId);\n sinkClient.DeleteSink(sinkName, _retryAWhile);\n Console.WriteLine($\"Deleted {sinkId}.\");\n }\n\n### Go\n\n\nTo learn how to install and use the client library for Logging, see\n[Logging client libraries](/logging/docs/reference/libraries).\n\n\nTo authenticate to Logging, set up Application Default Credentials.\nFor more information, see\n\n[Set up authentication for a local development environment](/docs/authentication/set-up-adc-local-dev-environment).\n\n import (\n \t\"context\"\n \t\"log\"\n\n \t\"cloud.google.com/go/logging/logadmin\"\n )\n\n func deleteSink(projectID string) error {\n \tctx := context.Background()\n \tclient, err := logadmin.https://cloud.google.com/go/docs/reference/cloud.google.com/go/logging/latest/logadmin.html#cloud_google_com_go_logging_logadmin_Client_NewClient(ctx, projectID)\n \tif err != nil {\n \t\tlog.Fatalf(\"logadmin.NewClient: %v\", err)\n \t}\n \tdefer client.https://cloud.google.com/go/docs/reference/cloud.google.com/go/logging/latest/logadmin.html#cloud_google_com_go_logging_logadmin_Client_Close()\n \tif err := client.https://cloud.google.com/go/docs/reference/cloud.google.com/go/logging/latest/logadmin.html#cloud_google_com_go_logging_logadmin_Client_DeleteSink(ctx, \"severe-errors-to-gcs\"); err != nil {\n \t\treturn err\n \t}\n \treturn nil\n }\n\n### Java\n\n\nTo learn how to install and use the client library for Logging, see\n[Logging client libraries](/logging/docs/reference/libraries).\n\n\nTo authenticate to Logging, set up Application Default Credentials.\nFor more information, see\n\n[Set up authentication for a local development environment](/docs/authentication/set-up-adc-local-dev-environment).\n\n boolean deleted = logging.deleteSink(sinkName);\n if (deleted) {\n // the sink was deleted\n } else {\n // the sink was not found\n }\n\n### Node.js\n\n\nTo learn how to install and use the client library for Logging, see\n[Logging client libraries](/logging/docs/reference/libraries).\n\n\nTo authenticate to Logging, set up Application Default Credentials.\nFor more information, see\n\n[Set up authentication for a local development environment](/docs/authentication/set-up-adc-local-dev-environment).\n\n // Imports the Google Cloud client library\n const {Logging} = require('https://cloud.google.com/nodejs/docs/reference/logging/latest/overview.html');\n\n // Creates a client\n const logging = new https://cloud.google.com/nodejs/docs/reference/logging/latest/logging/logging.html();\n\n /**\n * TODO(developer): Uncomment the following line to run the code.\n */\n // const sinkName = 'Name of sink to delete, e.g. my-sink';\n\n const sink = logging.sink(sinkName);\n\n async function deleteSink() {\n // See https://googleapis.dev/nodejs/logging/latest/Sink.html#delete\n await sink.delete();\n console.log(`Sink ${sinkName} deleted.`);\n }\n deleteSink();\n\n### PHP\n\n\nTo learn how to install and use the client library for Logging, see\n[Logging client libraries](/logging/docs/reference/libraries).\n\n\nTo authenticate to Logging, set up Application Default Credentials.\nFor more information, see\n\n[Set up authentication for a local development environment](/docs/authentication/set-up-adc-local-dev-environment).\n\n use Google\\Cloud\\Logging\\LoggingClient;\n\n /**\n * Delete a log sink.\n *\n * @param string $projectId The Google project ID.\n * @param string $sinkName The name of the sink.\n */\n function delete_sink($projectId, $sinkName)\n {\n $logging = new LoggingClient(['projectId' =\u003e $projectId]);\n $logging-\u003esink($sinkName)-\u003edelete();\n printf(\"Deleted a sink '%s'.\" . PHP_EOL, $sinkName);\n }\n\n### Python\n\n\nTo learn how to install and use the client library for Logging, see\n[Logging client libraries](/logging/docs/reference/libraries).\n\n\nTo authenticate to Logging, set up Application Default Credentials.\nFor more information, see\n\n[Set up authentication for a local development environment](/docs/authentication/set-up-adc-local-dev-environment).\n\n def delete_sink(sink_name):\n \"\"\"Deletes a sink.\"\"\"\n logging_client = logging.Client()\n sink = logging_client.sink(sink_name)\n\n sink.delete()\n\n print(\"Deleted sink {}\".format(sink.name))\n\n### Ruby\n\n\nTo learn how to install and use the client library for Logging, see\n[Logging client libraries](/logging/docs/reference/libraries).\n\n\nTo authenticate to Logging, set up Application Default Credentials.\nFor more information, see\n\n[Set up authentication for a local development environment](/docs/authentication/set-up-adc-local-dev-environment).\n\n require \"google/cloud/logging\"\n\n logging = Google::Cloud::https://cloud.google.com/ruby/docs/reference/google-cloud-service_control-v1/latest/Google-Cloud-Logging.html.https://cloud.google.com/ruby/docs/reference/google-cloud-logging/latest/Google-Cloud-Logging.html\n\n # sink_name = \"name-of-my-sink\"\n sink = logging.sink sink_name\n sink.delete\n puts \"Deleted sink: #{sink.name}\"\n\nWhat's next\n-----------\n\n\nTo search and filter code samples for other Google Cloud products, see the\n[Google Cloud sample browser](/docs/samples?product=logging)."]]