Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
Muitas linguagens de programação têm interfaces de gravação de registros padrão que podem ser
reconfiguradas para usar o Logging.
Gravar registros
Para gravar registros no Cloud Logging, faça o seguinte:
Grave os registros em arquivos de registro existentes, como syslog na instância de VM do Compute Engine, e use o Ops Agent para enviar os registros ao Cloud Logging. Para mais informações, consulte Agentes do Google Cloud Observability.
Configure um pacote de geração de registros padrão para enviar os registros gravados no Logging. Para mais informações, consulte as seguintes páginas de
detalhes:
Use a CLI gcloud. Para mais informações,
consulte a interface de linha de comando gcloud logging.
Associar dados de trace a entradas de registro
As entradas de registro podem conter informações sobre rastros. Ao incluir dados de rastreamento
nas entradas de registro, você pode correlacionar registros e rastros para permitir uma melhor
solução de problemas distribuídos. Para informações sobre a captura manual e
automática de informações de rastreamento em entradas de registro, consulte
Integrar com o Cloud Logging.
Ler registros
Para as entradas de registro no Logging, faça o seguinte:
No console Google Cloud , acesse a página Análise de registros.
[[["Fácil de entender","easyToUnderstand","thumb-up"],["Meu problema foi resolvido","solvedMyProblem","thumb-up"],["Outro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Informações incorretas ou exemplo de código","incorrectInformationOrSampleCode","thumb-down"],["Não contém as informações/amostras de que eu preciso","missingTheInformationSamplesINeed","thumb-down"],["Problema na tradução","translationIssue","thumb-down"],["Outro","otherDown","thumb-down"]],["Última atualização 2025-08-18 UTC."],[],[],null,["# Logging libraries overview\n\nMany programming languages have standard log-writing interfaces that you can reconfigure to use Logging.\n\n\u003cbr /\u003e\n\n| **Note:** You can instrument your application so that it collects application-specific information. Several open-source instrumentation frameworks let you collect metrics, logs, and traces from your application and send that data to any vendor, including Google Cloud. To instrument your application, we recommend that you use a vendor-neutral instrumentation framework that is open source, such as [OpenTelemetry](https://opentelemetry.io/), instead of vendor- and product-specific APIs or client libraries.\n|\n| \u003cbr /\u003e\n|\n| For information about instrumenting your applications by using\n| vendor-neutral instrumentation frameworks, see\n| [Instrumentation and observability](/stackdriver/docs/instrumentation/overview).\n\nWrite logs\n----------\n\nTo write logs to Cloud Logging, you can do any of\nthe following:\n\n- Write your logs to existing log files such as `syslog` on your Compute EngineVM instance and use the Ops Agent to send the logs to Cloud Logging. For more information, see [Google Cloud Observability agents](/logging/docs/agent).\n- Configure a standard logging package to send the logs you write to Logging. For more information, see the following detail pages:\n - Any language: [fluentd](https://www.fluentd.org/)\n - [C#: Using ASP.NET or calling\n the API](/logging/docs/integrate/dotnet)\n - [Java: Using Logback and\n java.util.logging](/logging/docs/setup/java)\n - [Go: Using standard logging](/logging/docs/setup/go)\n - [Node.js: Using Winston and Bunyan](/logging/docs/setup/nodejs)\n - [PHP: Using PSR-3 logger](/logging/docs/setup/php)\n - [Python: Using the standard logging\n facility](/logging/docs/setup/python)\n - [Ruby: Using the Google Cloud Observability\n gem](/logging/docs/setup/ruby)\n- Call the Logging API using Logging's [Client Libraries](/logging/docs/reference/libraries) for your programming language.\n- Call the Logging API REST endpoint directly. See the [Logging API reference documentation](/logging/docs/reference/v2/rest).\n- Use the [gcloud CLI](/sdk/docs). For more information, see the [`gcloud logging`](/logging/docs/reference/tools/gcloud-logging) command-line interface.\n\n\u003cbr /\u003e\n\n| **Note:** Incoming log entries with timestamps that are more than the [logs retention period](/logging/quotas#logs_retention_periods) in the past or that are more than 24 hours in the future are discarded.\n\nAssociate trace data with log entries\n-------------------------------------\n\nLog entries can contain information about traces. By including trace data\nin log entries, you can correlate logs and traces to enable better\ndistributed troubleshooting. For information about manual and\nautomatic capture of trace information in log entries, see\n[Integrate with Cloud Logging](/trace/docs/trace-log-integration).\n\nRead logs\n---------\n\nTo read log entries in Logging, you can do any of\nthe following:\n\n- In the Google Cloud console, go to the **Logs Explorer** page:\n\n [Go to **Logs Explorer**](https://console.cloud.google.com/logs/query)\n\n \u003cbr /\u003e\n\n If you use the search bar to find this page, then select the result whose subheading is\n **Logging**.\n\n For more information, see\n [Logs Explorer overview](/logging/docs/view/logs-explorer-interface).\n- Call the Logging API through\n the [client libraries](/logging/docs/reference/libraries) for your\n programming language.\n\n- Call the Logging API REST endpoints directly.\n See the [Logging API reference documentation](/logging/docs/reference/v2/rest).\n\n- Use the [gcloud CLI](/sdk/docs). For more information, see the\n [`gcloud logging`](/logging/docs/reference/tools/gcloud-logging) command-line interface."]]