Como usuario New Relic, puede ejecutar la misma consulta NRQL una y otra vez para monitorear patrones críticos, verificar condiciones específicas o generar reportes periódicos. Por ejemplo, puede que necesite comprobar diariamente si hay transacciones fallidas, controlar semanalmente la tasa de errores o realizar un seguimiento de las métricas de rendimiento por hora en toda su aplicación. Este proceso manual consume mucho tiempo y facilita que se pase por alto información importante cuando no se está realizando un monitoreo activo.
Las búsquedas NRQL programadas solucionan este problema automatizando las consultas repetitivas. Puedes programar las consultas para que se ejecuten automáticamente y recibir los resultados por email, de modo que te mantengas informado sobre patrones críticos sin necesidad de un seguimiento manual constante.
Lo que puedes hacer
Las búsquedas NRQL programadas te permiten:
- Automatice las consultas repetitivas: convierta las consultas manuales en un flujo de trabajo automatizado que se ejecute según su cronograma.
- Start from anywhere: Create a scheduled search from Administration or directly from the Logs UI.
- Mantener informado de forma proactiva: Reciba notificaciones por email con los resultados de la consulta directamente en su bandeja de entrada.
- Set notification conditions: Choose to get notified on every run, or only when your results meet a condition you define based on the number of results in your query.
- Schedule flexibly: Use custom cron expression schedules to define when queries run.
- Choose your output format: Export results as CSV or JSON files attached to email notifications.
- Collaborate with your team: Send scheduled search results to multiple email recipients.
- Manage everything centrally: View, edit, and manage all your scheduled searches from a single location in the Administration UI, regardless of where you created them.
Precios
Scheduled NRQL searches have no separate pricing. You pay only the standard query cost of running the underlying NRQL query, based on your account's pricing model.
Requisitos previos
Para emplear búsquedas NRQL programadas, necesita:
- Acceso a la cuenta: Acceso a la cuenta donde desea programar búsquedas.
- Acceso a los datos: Licencias adecuadas para consultar los datos que desea programar. Por ejemplo, si se programa una consulta sobre datos de log, se necesita acceso a esos datos de log.
Permisos
By default, the All product admin and Standard user standard roles already include Read and Modify access to scheduled searches, and only All product admin includes Delete access. These roles also already include the User API Keys (for self) > Modify capability (account.create.own_api_keys), which a scheduled search needs to run successfully.
If you want to create a custom role and assign specific Scheduled Search capabilities to it, use either of the following methods:
- NerdGraph: Create an account-scoped custom role via NerdGraph, and add the permission IDs from the following table to the
permissionIdsarray. - UI: Create a new custom role, or edit an existing one, to add the Scheduled Search capability from the Scheduled Search and Reports section.
Importante
Some capabilities grant broader access than others. For example, Delete also grants read and modify access. If you only want to grant a narrower capability, select that specific capability instead of Delete.
The following table lists each capability, its permission IDs, and what it grants:
Capacidad | ID de permiso | Descripción |
|---|---|---|
Scheduled Search > Read |
| View scheduled searches |
Scheduled Search > Modify |
| View, create, and edit scheduled searches |
Scheduled Search > Delete |
| View, create, edit, and delete scheduled searches |
User API Keys (for self) > Modify |
| Required to run a scheduled search. New Relic uses it to create a user API key on your behalf, to maintain your user context. Without it, the run fails. |
Programa una nueva búsqueda
New Relic guides you through this flow directly in the product. Each step below covers what needs to happen there and anything that isn't obvious from the screen.
Access the scheduled search creation flow:
Choose the entry point that fits your workflow. Both lead to the same configuration flow.
Vaya a one.newrelic.com > Administration > Scheduled Searches y haga clic en Schedule a search.
From the logs UI, use either of these options:
At the top-right corner, click the menu and select Schedule a search.
Under the query trend chart, click the clock icon.
If you already composed and ran a query, it carries over into the configuration flow. Otherwise, you can draft your query in the next step.
Sugerencia
You can create a scheduled search from Administration or the Logs UI, but you can only view, edit, or delete existing scheduled searches from Administration > Scheduled Searches.
Configura tu consulta:
Draft and test your NRQL query, then continue.
Configurar notificación:
Set up the following:
Name the search, then set a destination for the results. You can only send results to email destinations.
- If the destination exists, select it from the list.
- If it doesn't exist, add one or more email recipients and name the destination.
Choose a subject, message, and output format for the email.
Set the notification condition under Send notification. It defaults to Always. To send only when your results meet a count you define, customize it here.
Advertencia
Scheduled search results are attached to email as CSV or JSON files and may contain sensitive data. Review your email destinations to confirm only intended recipients are included.
Establece un horario:
Choose the following:
Choose a frequency: hourly, daily, weekly, or a custom cron expression.
Select a time zone for the schedule.
If you use a cron expression, the following are some common patterns for reference:
0 * * * *- Cada hora en punto0 9 * * *- Todos los días a las 9:00 AM0 9 * * 1- Todos los lunes a las 9:00 AM0 0 1 * *- El primer día de cada mes a medianoche*/15 * * * *- Cada 15 minutos0 9 * * 1-5- Todos los días laborables a las 9:00 AMSugerencia
The shortest supported interval is every 10 minutes.
If you set a notification condition instead of sending on every run, New Relic checks the condition at the exact scheduled run time. It doesn't track fluctuations between runs, so if your results drop below the condition's threshold before the next run, you won't get a notification for that run.
Review, confirm, and schedule the search:
Review your configuration, then schedule the search. It appears on the Scheduled searches page.
Gestionar búsquedas programadas
The Scheduled searches page in the Administration UI lists all your automated searches, including any you created from the Logs UI. From the menu, you can view, edit, or delete a search based on your permissions.
Temas relacionados
For related information, see:
- Obtenga más información sobre NRQL Consulta para crear búsquedas automatizadas más sofisticadas.
- Configure los destinos de email de alerta para ampliar sus opciones de notificación.
- Explore la automatización de flujos de trabajo para posibilidades de automatización más avanzadas.