> ## Documentation Index
> Fetch the complete documentation index at: https://statsig-4b2ff144-serverless-cloudflare.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Topline Alerts with Logs

> Detect infrastructure regressions by evaluating logs in real time

By combining log filters with [Topline Alerts](/product-analytics/topline-alerts), you will know immediately when things start failing without writing custom scripts or dashboards.

### When to Use Log-based Alerts

* **Monitoring success rates** - Catch regressions before they impact SLOs.
* **Detecting error spikes** - Trigger when 5xx or other errors rise above baseline.
* **Isolate by segment** - Identify failures concentrated in by region, client, or device type

## Create a Log-based Topline Alert (Statsig Cloud)

In this example, we're going to create a monitor for the success rate of a GET request.

<Steps>
  <Step title="Navigate to Topline Alerts">
    <ul>
      <li>Go to <strong>Analytics → Topline Alerts</strong> in the product menu.</li>
      <li>Click <strong>+Create</strong>.</li>
      <li>Enter a name for your alert.</li>
    </ul>

    <Frame>
      <img src="https://mintcdn.com/statsig-4b2ff144-serverless-cloudflare/4Y9GDUOpHMGP4hLA/images/infra-analytics/loglinealert-1.png?fit=max&auto=format&n=4Y9GDUOpHMGP4hLA&q=85&s=6bc1c2cb992651239ebd0cf0d481d08d" alt="Alert setup step 1" width="1066" height="387" data-path="images/infra-analytics/loglinealert-1.png" />
    </Frame>
  </Step>

  <Step title="Define Alert Criteria">
    <ul>
      <li>Select <code>statsig::log\_line</code> as your event.</li>
      <li>Apply filters to define what constitutes success and failure.</li>
    </ul>

    If you're unsure which fields to filter on, open the <a href="/infra-analytics/logs-explorer">Logs Explorer</a> and inspect the log body.

    <Frame>
      <img src="https://mintcdn.com/statsig-4b2ff144-serverless-cloudflare/4Y9GDUOpHMGP4hLA/images/infra-analytics/loglinealert-2.png?fit=max&auto=format&n=4Y9GDUOpHMGP4hLA&q=85&s=1ab3013a384b1ec63508c51a90375e1b" alt="Alert setup step 2" width="958" height="488" data-path="images/infra-analytics/loglinealert-2.png" />
    </Frame>
  </Step>

  <Step title="Set Up Evaluation Formula">
    <li>Define the formula for calculating your success rate.</li>
    <li> (Optional) Add a group-by dimension.</li>

    <Frame>
      <img src="https://mintcdn.com/statsig-4b2ff144-serverless-cloudflare/4Y9GDUOpHMGP4hLA/images/infra-analytics/loglinealert-3.png?fit=max&auto=format&n=4Y9GDUOpHMGP4hLA&q=85&s=7212fb7f04c80d7b5d78467817398ded" alt="Alert setup step 3" width="958" height="166" data-path="images/infra-analytics/loglinealert-3.png" />
    </Frame>
  </Step>

  <Step title="Configure Alert Thresholds">
    <li>Set thresholds and the evaluation window.</li>

    <p title="Example">
      In this example, we will trigger a warning when success rate drops below 99.5%. We will trigger an alert when success rate drops below 99.0%.
    </p>

    <Frame>
      <img src="https://mintcdn.com/statsig-4b2ff144-serverless-cloudflare/4Y9GDUOpHMGP4hLA/images/infra-analytics/loglinealert-4.png?fit=max&auto=format&n=4Y9GDUOpHMGP4hLA&q=85&s=d8d6e22b133c6359f7f7c0bf7b7c6452" alt="Alert setup step 4" width="955" height="297" data-path="images/infra-analytics/loglinealert-4.png" />
    </Frame>
  </Step>

  <Step title="Configure Notifications">
    <ul>
      <li>Add the alert title and description for context.</li>
      <li>Include diagnostic hints (e.g. "Check version X" or "Android requests timing out").</li>
      <li>Add subscribers.</li>
      <li>Set priority.</li>
    </ul>

    <Frame>
      <img src="https://mintcdn.com/statsig-4b2ff144-serverless-cloudflare/4Y9GDUOpHMGP4hLA/images/infra-analytics/loglinealert-5.png?fit=max&auto=format&n=4Y9GDUOpHMGP4hLA&q=85&s=38edf7aa5fcfec25116002beb9910bda" alt="Alert setup step 5" width="971" height="598" data-path="images/infra-analytics/loglinealert-5.png" />
    </Frame>
  </Step>

  <Step title="Save the Alert">
    <li>Click <strong>Save</strong>. </li>
    <li>Once your alert is set up, you can visit the <strong>Diagnostics</strong> tab to see a history of alert triggers.</li>

    <Frame>
      <img src="https://mintcdn.com/statsig-4b2ff144-serverless-cloudflare/4Y9GDUOpHMGP4hLA/images/infra-analytics/loglinealert-6.png?fit=max&auto=format&n=4Y9GDUOpHMGP4hLA&q=85&s=cc9319d2ee5d4fdb05b04c048bf7bf9c" alt="Alert setup step 6" width="1042" height="1161" data-path="images/infra-analytics/loglinealert-6.png" />
    </Frame>
  </Step>
</Steps>

***

## Best Practices

* Set up [Slack notifications](/integrations/slack) for team visibility
* Keep formulas simple (ratios & percentages are easiest to scan)
* Add group-by dimensions (like country or app version) to pinpoint where issues occur
* Write clear notification text that explains what the alert means
