Risolvere i problemi relativi ai criteri di avviso basati su log
Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Questo documento fornisce informazioni per la risoluzione dei problemi relativi all'utilizzo delle policy di avviso basate su log.
Non sono disponibili log corrispondenti
Quando testi il filtro per una criterio di avviso basata sui log, non vengono restituiti log.
Controlla i seguenti errori comuni:
Stai cercando di filtrare i log esclusi. I criteri di avviso basati su log funzionano
solo sui log inclusi.
Stai tentando di filtrare in base ai bucket log o ad altre risorse Google Cloud
come account di fatturazione Cloud o organizzazioni.
I criteri di avviso basati su log operano a livello di progetto. Google Cloud
La query è troppo restrittiva. Verifica che i nomi dei campi e le espressioni regolari siano corretti. Puoi utilizzare il riquadro Query in Esplora log
o il pulsante Visualizza l'anteprima dei log nell'interfaccia di configurazione degli avvisi per
convalidare la query. Per informazioni sulla creazione di query, consulta
Linguaggio di query di Logging.
La policy di avviso non funziona
Hai creato un criterio di avviso basato su log, ma non funziona come ti
aspettavi. Ad esempio:
Cloud Monitoring non invia notifiche per il criterio di avviso.
Se la tua criterio di avviso estrae le etichette, verifica che non estragga l'etichetta timestamp. L'estrazione di questa etichetta impedisce
allacriterio di avvisoo di creare incidenti e inviare notifiche.
Se hai smesso di ricevere notifiche, potresti aver raggiunto
il limite di frequenza di 20 incidenti al giorno per ogni criterio di avviso basato sui log. Controlla la notifica
più recente che hai ricevuto per questacriterio di avvisoo basata sui log e cerca
un'affermazione che indichi che il limite di incidenti è stato superato per la giornata.
Se non ricevi il numero di notifiche che ti aspetti, controlla la configurazione della criterio di avviso basata sui log. Potrebbe essere necessario modificare
il valore dell'intervallo di tempo tra le notifiche.
Cloud Monitoring non crea incidenti quando le condizioni dei criteri
vengono soddisfatte.
Se la tua criterio di avviso estrae le etichette, verifica che non estragga l'etichetta timestamp. L'estrazione di questa etichetta impedisce
allacriterio di avvisoo di creare incidenti e inviare notifiche.
Vai alla pagina Incidenti in Cloud Monitoring e filtra la
tabella in base al nome della policy. I risultati mostrano gli avvisi attuali e passati:
Se non sono presenti incidenti, verifica che la query utilizzata trovi log corrispondenti. Verifica che i nomi dei campi e le espressioni regolari siano corretti. Puoi utilizzare il riquadro Query in Esplora log
o il pulsante Visualizza l'anteprima dei log nell'interfaccia di configurazione degli avvisi per
convalidare la query. Per informazioni sulla creazione di query, consulta
Linguaggio di query di Logging.
Se ci sono stati incidenti passati, ma non di recenti per il giorno corrente,
potresti aver raggiunto il limite di 20 incidenti al giorno per ogni criterio di avviso basato sui log.
Controlla la notifica più recente che hai ricevuto per questa norma di avviso e cerca un'indicazione che il limite di incidenti è stato superato per la giornata.
Cloud Monitoring crea incidenti per un numero maggiore di voci di log rispetto a quanto previsto:
È possibile che la query dei log non sia sufficientemente restrittiva.
Verifica che i nomi dei campi e le espressioni regolari siano corretti. Puoi utilizzare il riquadro Query in Esplora log
o il pulsante Visualizza l'anteprima dei log nell'interfaccia di configurazione degli avvisi per
convalidare la query. Per informazioni sulla creazione di query, consulta
Linguaggio di query di Logging.
Gli incidenti non vengono chiusi
Se non chiudi un incidente, Cloud Logging lo chiude
dopo che è trascorsa la durata di chiusura automatica per il criterio di avviso.
La durata della chiusura automatica predefinita è di 7 giorni, ma puoi impostarla su un valore compreso tra 30 minuti e 7 giorni. Puoi anche chiudere manualmente gli incidenti in qualsiasi momento, come descritto in Chiusura degli incidenti.
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Difficile da capire","hardToUnderstand","thumb-down"],["Informazioni o codice di esempio errati","incorrectInformationOrSampleCode","thumb-down"],["Mancano le informazioni o gli esempi di cui ho bisogno","missingTheInformationSamplesINeed","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 2025-09-05 UTC."],[],[],null,["# Troubleshoot log-based alerting policies\n\n\u003cbr /\u003e\n\nThis document provides troubleshooting information for using log-based alerting\npolicies.\n\nNo matching logs are available\n------------------------------\n\nWhen you test your filter for a log-based alerting policy, no logs are returned.\nCheck the following common errors:\n\n- You are trying to filter on excluded logs. Log-based alerting policies operate\n only on included logs.\n\n- You are trying to filter by log buckets, or for other Google Cloud\n resources such as Cloud Billing accounts or organizations.\n Log-based alerting policies operate at Google Cloud project level.\n\n- Your query is too restrictive. Check that your field names and regular\n expressions are correct. You can use the **Query** pane in Logs Explorer\n or the **Preview logs** button in the alert-configuration interface to\n help validate the query. For information about creating queries, see\n [Logging query language](/logging/docs/view/logging-query-language).\n\nAlerting policy isn't working\n-----------------------------\n\nYou've created a log-based alerting policy, but it isn't working as you\nexpected. For example:\n\n- Cloud Monitoring isn't sending notifications for the alerting policy.\n\n If your alerting policy extracts labels, then verify that it isn't\n extracting the `timestamp` label. Extraction of this label prevents the\n alerting policy from creating incidents and sending notifications.\n\n If you've stopped receiving notifications, then you might have reached\n the rate limit of 20 incidents a day for each log-based alerting policy. Check the most recent\n notification you received for this log-based alerting policy and look for a\n statement that the incident limit has been exceeded for the day.\n\n If you aren't receiving as many notifications as you expect, then check\n the configuration of the log-based alerting policy. You might need to adjust\n the value for time between notifications.\n- Cloud Monitoring isn't creating incidents when policy conditions are\n met.\n\n If your alerting policy extracts labels, then verify that it isn't\n extracting the `timestamp` label. Extraction of this label prevents the\n alerting policy from creating incidents and sending notifications.\n\n Go to the **Incidents** page in Cloud Monitoring and filter the\n table by policy name. The results show the current and past alerts:\n - If there are no incidents, then verify that the query used is\n finding matching logs. Check that your field names and regular\n expressions are correct. You can use the **Query** pane in Logs Explorer\n or the **Preview logs** button in the alert-configuration interface to\n help validate the query. For information about creating queries, see\n [Logging query language](/logging/docs/view/logging-query-language).\n\n - If there are past incidents but no recent ones for the current day,\n then you might have reached the limit of 20 incidents a day for each log-based alerting policy.\n Check the most recent notification you received for this alerting\n policy and look for a statement that the incident limit has been\n exceeded for the day.\n\n- Cloud Monitoring creates incidents for more log entries than you\n expected:\n\n It's possible that your log query is insufficiently restrictive.\n Check that your field names and regular\n expressions are correct. You can use the **Query** pane in Logs Explorer\n or the **Preview logs** button in the alert-configuration interface to\n help validate the query. For information about creating queries, see\n [Logging query language](/logging/docs/view/logging-query-language).\n\nIncidents aren't closing\n------------------------\n\nIf you don't close an incident, then Cloud Logging closes the\nincident after the autoclose duration for the alerting policy has passed.\nThe default autoclose duration is 7 days, but you can set\nit to any value between 30 minutes and\n7 days. You can also manually close incidents at\nany time, as described in [Closing incidents](/logging/docs/alerting/log-based-incidents#closing)."]]