---
title: "System log"
description: "Spook adds an action that lists the errors and warnings of Home Assistant, the ones on the logs page, so an automation can count them, filter them by integration, or send them to your phone."
canonical_url: "https://spook.boo/system-log"
---
# System log

> Spook adds an action that lists the errors and warnings of Home Assistant, the ones on the logs page, so an automation can count them, filter them by integration, or send them to your phone.

The system log integration keeps the errors and warnings of Home Assistant. They are the ones on the logs page, under **Settings** > **System** > **Logs**: each one once, with how often it happened, and when it last did.

Only that page shows them. An automation cannot see what is in there: not to tell you when an integration starts throwing errors, not to put the count on a dashboard. Spook adds an action for that: list the errors and warnings.

## Actions

Spook adds one action to the system log integration. You find it wherever you add an action, marked with a 👻.

### List errors and warnings

Lists the errors and warnings, the most recent first: what was logged, the integration it is about, how often it happened, and when it first and last did. The same ones the logs page shows.

Ask for only errors, or only the ones of one integration, and you get exactly those. The integration is worked out the same way the logs page does it: from the name of the logger, or else from the file the message came from. Something that is not about an integration, like a library logging on its own, has none.

This action is for administrators only, like the logs page. An error can tell more than everybody in your home needs to read. Your automations can always run it. So can your scripts, unless a user who is not an administrator starts one.

**How to use it**

1. Open the automation or script that needs the errors, and select **Add action**.
2. Search for **errors and warnings**, and select **System log: List errors and warnings 👻**.
3. To list only some, pick levels under **Log level**, or type domains under **Integration**, like `hue`. Leave both empty for all of them.
4. Under **Response variable**, give the list a name, like `result`. The steps after this one can use it.
5. Select **Save**.

Just want to see it work? [Try this action](https://my.home-assistant.io/redirect/developer_call_service/?service=system_log.list) opens it in your Home Assistant. Run it, and the response shows the errors and warnings.

**Technical details**

| Action properties |
| --- |
| Action | System log: List errors and warnings 👻 |
| Action name | `system_log.list` |
| Action targets | No targets |
| Action response | Yes, the errors and warnings |
| Spook's influence | Newly added action |
| Tools | [Try this action](https://my.home-assistant.io/redirect/developer_call_service/?service=system_log.list) [![Open your Home Assistant instance and show the Actions tool with a specific action selected.](https://my.home-assistant.io/badges/developer_call_service.svg)](https://my.home-assistant.io/redirect/developer_call_service/?service=system_log.list) |

| Action data parameters |
| --- |
| Attribute | Type | Required | Default / Example |
| `level` | string \| list of strings | No | `error` |
| `integration` | string \| list of strings | No | `hue` |
| `limit` | integer | No | All of them |

An entry has to match both `level` and `integration`. More than one value in a field widens that field: two levels find the entries of either. An empty field counts as left out, and so does an empty integration in the list. The levels are `critical`, `error` and `warning`. The system log keeps nothing below a warning, so `info` or `debug` is refused instead of always giving an empty list.

The `limit` counts after the filters, and keeps the most recent ones.

The response:

| **Attribute** | **Type** | **Description** |
| --- | --- | --- |
| `entries` | list | The errors and warnings, the most recent first. Empty when there are none. |
| `entries[].name` | string | The logger it was logged with, like `homeassistant.components.hue.light`. |
| `entries[].integration` | string or `null` | The domain of the integration it is about, like `hue`. `null` when it is not about one. |
| `entries[].level` | string | `critical`, `error` or `warning`. |
| `entries[].message` | list of strings | What was logged. The same error with different words is one entry, with up to five of its messages. |
| `entries[].exception` | string | The traceback, when an exception came with it. Empty when none did. |
| `entries[].source` | string | The file it was logged from, like `homeassistant/components/hue/light.py`. |
| `entries[].line` | integer | The line in that file. |
| `entries[].count` | integer | How often it happened. |
| `entries[].first_occurred` | string | When it first happened, in UTC, like `2026-12-01T09:30:00+00:00`. |
| `entries[].last_occurred` | string | When it last happened, in UTC. |

**Example actions in YAML**

A sensor for your dashboard with the number of errors, refreshed every five minutes:

```yaml
template:
  - triggers:
      - trigger: homeassistant
        event: start
      - trigger: time_pattern
        minutes: /5
    actions:
      - action: system_log.list
        data:
          level:
            - critical
            - error
        response_variable: result
    sensor:
      - name: Errors in the log
        icon: mdi:alert-circle
        state: "{{ result.entries | count }}"
```

Every morning, send yourself the five most recent errors of Z-Wave:

```yaml
triggers:
  - trigger: time
    at: "08:00:00"
actions:
  - action: system_log.list
    data:
      integration: zwave_js
      level: error
      limit: 5
    response_variable: result
  - if: "{{ result.entries | count > 0 }}"
    then:
      - action: notify.mobile_app_phone
        data:
          title: Z-Wave errors
          message: >-
            {% for entry in result.entries %}
            {{ entry.count }}x {{ entry.message | last }}
            {% endfor %}
```

**Known limitations**

- The list is the log at the moment of the call. Home Assistant keeps 50 entries by default, and lets go of the oldest when a new one comes in. Set `max_entries` under `system_log` in your configuration to keep more.
- The log is kept in memory. After a restart, only what was logged since is listed. Clearing it on the logs page empties the list too.
- The traceback in `exception` can be long. Send `message` to a phone, not the traceback.


## Sitemap

See the full [sitemap](https://spook.boo/sitemap.md) for all pages.
