Pastikan peran Identity and Access Management Anda menyertakan izin yang diperlukan untuk membuat dan melihat metrik berbasis log, serta membuat kebijakan pemberitahuan.
Untuk mengetahui detailnya, lihat Izin untuk metrik berbasis log.
Mencantumkan metrik berbasis log
Untuk melihat daftar metrik berbasis log untuk project Google Cloud Anda, lakukan hal berikut:
Di Google Cloud konsol, buka halaman Metrik Berbasis Log:
Jika Anda menggunakan kotak penelusuran untuk menemukan halaman ini, pilih hasil yang subjudulnya adalah Logging.
Pilih project Google Cloud yang ada.
Antarmuka metrik berbasis log menampilkan dua daftar jenis metrik:
Metrik sistem dan Metrik yang ditentukan pengguna.
Panel Metrik yang ditentukan pengguna di antarmuka metrik berbasis log memiliki beberapa fitur untuk membantu Anda mengelola metrik yang ditentukan pengguna di projectGoogle Cloud :
Tabel metrik yang ditentukan pengguna mencakup kolom Name, Description,
Type, dan Filter. Kolom ini ditentukan saat Anda membuat metrik.
Panel Filter user-defined metrics memungkinkan Anda memfilter daftar metrik
berdasarkan penelusuran teks atau Name, Description, dan Filter metrik.
Tabel metrik yang ditentukan pengguna menyertakan kolom untuk
Penggunaan bulan sebelumnya dan Penggunaan bulan berjalan (MTD). Data penggunaan ini berguna, misalnya, jika Anda ingin menentukan metrik mana yang menyerap data terbanyak atau untuk memperkirakan tagihan Anda.
Menu Lainnyamore_vert untuk setiap metrik di panel metrik yang ditentukan pengguna berisi fitur tambahan untuk mengelola metrik:
Lihat detail metrik: Menampilkan Nama, Jenis,
Deskripsi, Filter, Unit, dan Label metrik, jika ditentukan.
Edit metrik: Memungkinkan Anda mengedit kolom tertentu untuk metrik.
Nonaktifkan metrik: Memungkinkan Anda menghentikan penghitungan metrik.
Anda dapat mengaktifkan kembali metrik yang dinonaktifkan dari menu yang sama.
Hapus metrik: Memungkinkan Anda menghapus metrik.
Lihat log untuk metrik: Membuka Logs Explorer dan mengisi filter metrik di Builder kueri, lalu menjalankan kueri.
Lihat di Metrics Explorer: Memungkinkan Anda memetakan metrik.
Buat pemberitahuan dari metrik: Memungkinkan Anda mengonfigurasi notifikasi saat metrik berbasis log cocok dengan kriteria yang Anda tentukan. Untuk mengetahui informasi
selengkapnya, lihat Pemberitahuan tentang metrik berbasis log.
Membuat diagram metrik berbasis log
Untuk membuat diagram metrik berbasis log, lakukan tindakan berikut:
Di Google Cloud konsol, buka halaman Metrik Berbasis Log:
Jika Anda menggunakan kotak penelusuran untuk menemukan halaman ini, pilih hasil yang subjudulnya adalah Logging.
Temukan metrik yang ingin Anda lihat, lalu pilih
Lihat di Metrics Explorer dari menu Lainnyamore_vert metrik.
Metrics Explorer akan terbuka dan telah dikonfigurasi sebelumnya untuk Anda. Namun, Anda mungkin ingin mengubah beberapa setelan diagram.
Misalnya, screenshot berikut menunjukkan diagram metrik sistem
dengan nama byte_count untuk project Google Cloud tertentu:
Entri Aggregation menunjukkan bahwa setiap deret waktu pada diagram adalah
jumlah byte yang ditulis ke log tertentu. Pada contoh sebelumnya, project berisi beberapa log, sehingga diagram menampilkan beberapa deret waktu.
Untuk melihat data log tertentu, tambahkan filter. Misalnya, untuk melihat metrik byte_count untuk entri log yang ditulis oleh BigQuery, klik Tambahkan filter, pilih log, lalu pilih entri BigQuery. Diagram kini menampilkan satu deret waktu, yang menunjukkan total
byte log yang ditulis oleh BigQuery.
Jika Anda ingin melihat metrik byte_count berdasarkan tingkat keparahan
entri log, ubah menu kedua di entri Aggregation dari
None menjadi Severity. Diagram berikut menunjukkan metrik byte_count yang ditampilkan menurut tingkat keparahan untuk log yang ditulis oleh BigQuery:
Untuk metrik berbasis log dengan nilai distribusi, luaskan Diagram garis dan
pilih Diagram peta panas.
Opsional: Untuk menyimpan diagram sebagai referensi di masa mendatang, klik Simpan diagram di toolbar, lalu selesaikan dialog. Anda dapat menyimpan diagram ke dasbor yang ada atau membuat dasbor baru.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-08-11 UTC."],[],[],null,["# List and chart log-based metrics\n\nThis document describes how to list and chart log-based metrics by using the\nGoogle Cloud console. For information about creating log-based metrics, see\n[Configure counter metrics](/logging/docs/logs-based-metrics/counter-metrics)\nand [Configure distribution metrics](/logging/docs/logs-based-metrics/distribution-metrics).\n\nBefore you begin\n----------------\n\nEnsure that your Identity and Access Management role includes the permissions required to\ncreate and view log-based metrics, and to create alerting policies.\nFor details, see\n[Permissions for log-based metrics](/logging/docs/access-control#metrics-permissions).\n\nList log-based metrics\n----------------------\n\nTo view a list of log-based metrics for your Google Cloud project, do the\nfollowing:\n\n1. In the Google Cloud console, go to the **Log-based Metrics** page:\n\n [Go to **Log-based Metrics**](https://console.cloud.google.com/logs/metrics)\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**.\n2. Select an existing Google Cloud project.\n The log-based metrics interface displays two lists of metric-types:\n **System metrics** and **User-defined metrics**.\n\n The **User-defined metrics** pane of the log-based metrics interface has\n several features to help you manage the user-defined metrics in your\n Google Cloud project:\n - The user-defined metrics table includes **Name** , **Description** ,\n **Type** , and **Filter** columns. These fields are specified when you\n create the metric.\n\n - The **Filter user-defined metrics** pane lets you filter your metric list\n by text search or metric **Name** , **Description** , and **Filter**.\n\n - The user-defined metrics table includes columns for\n **Previous month usage** and **Month-to-date usage (MTD)** . This usage\n data is useful, for example, if\n you want to determine which metrics ingest the most data or to\n [estimate your bills](/stackdriver/estimating-bills).\n\n The *more_vert* **More** menu for each metric in your user-defined\n metrics pane contains additional features for managing your metrics:\n\n - **View metric details** : Shows you the metric's **Name** , **Type** , **Description** , **Filter** , **Units** , and **Labels**, if defined.\n - **Edit metric**: Lets you edit certain fields for the metric.\n - **Disable metric**: Lets you stops the metric from being calculated. You can re-enable a disabled metric from the same menu.\n - **Delete metric**: Lets you delete the metric.\n - **View logs for metric** : Takes you to the Logs Explorer and populates the metric's filter in the **Query builder** and runs the query.\n - **View in Metrics Explorer**: Lets you chart the metric.\n - **Create alert from metric** : Lets you configure notifications when a log-based metric matches criteria that you specify. For more information, see [Alert on log-based metrics](/logging/docs/logs-based-metrics/charts-and-alerts).\n\nChart log-based metrics\n-----------------------\n\nTo create a chart of a log-based metric, do the following:\n\n1. In the Google Cloud console, go to the **Log-based Metrics** page:\n\n [Go to **Log-based Metrics**](https://console.cloud.google.com/logs/metrics)\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**.\n2. Find the metric you want to view, and then select\n **View in Metrics Explorer** from the metric's *more_vert* **More**\n menu.\n\n [Metrics Explorer](/monitoring/charts/metrics-explorer) opens and\n is preconfigured for you. However, you might want to change some chart\n settings.\n\n For example, the following screenshot shows a chart of the system metric\n with the name `byte_count` for a particular Google Cloud project:\n\n The **Aggregation** entry shows that each time series on the chart is\n a sum of the bytes written to a specific log. In the previous example, the\n project contains multiple logs, so the chart displays multiple time series.\n\n To view the data for a specific log, add a filter. For example, to view the\n `byte_count` metric for log entries written by BigQuery,\n click **Add filter** , select **log** , and then select the BigQuery\n entry. The chart now displays a single time series, which shows the total of\n the log bytes written by BigQuery.\n If you want to view the `byte_count` metric by the severity of the\n log entry, then change the second menu in the **Aggregation** entry from\n **None** to **Severity** . The following chart shows the `byte_count` metric\n displayed by severity level for logs written by BigQuery:\n\n3. For distribution-valued log-based metrics, expand **Line chart** and\n select **Heatmap chart**.\n\n For more information about distribution-valued metrics, see\n [Distribution metrics](/monitoring/charts/charting-distribution-metrics) and\n [Percentiles and distribution-valued metrics](/monitoring/api/v3/distribution-metrics).\n4. Optional: To save the chart for future reference, click **Save chart**\n in the toolbar, and then complete the dialog. You can save the\n chart to an existing dashboard or create a new dashboard.\n\n| **Tip:** If you don't see any data in the graph, try increasing the time interval, which defaults to one hour, or changing the default settings.\n\nWhat's next\n-----------\n\n- To create an alerting policy for a log-based metric, see [Alert on log-based metrics](/logging/docs/logs-based-metrics/charts-and-alerts).\n- For more information about charting metric data, see these\n Monitoring resources:\n\n - [Metrics Explorer](/monitoring/charts/metrics-explorer)\n - [Creating charts](/monitoring/charts)"]]