Skip to main content

Searching the logs

The outbound delivery log and the inbound call log can be searched through Laravel Scout. Nothing about it is on by default, and nothing about it is wired for you: laravel/scout is a Composer suggestion, not a dependency, and flipping search.enabled on its own indexes nothing at all — silently, because the model the dashboard reads is still the un-indexed one.

Three steps, all required, in this order.

1. Install Scout

composer require laravel/scout

Pick the engine in config/scout.php, not here — that setting is Scout's. database needs no extra service; meilisearch needs a running Meilisearch plus MEILISEARCH_HOST and MEILISEARCH_KEY.

2. Switch the layer on

// config/webhooks.php
'search' => [
'enabled' => true,
],

While this is false the shipped models report shouldBeSearchable() as false, so no row is ever written to an index — which is why the flag is safe to leave on in an environment that has no engine yet.

3. Point something searchable at the table

This is the step that has no default, and the reason step 2 alone appears to do nothing.

// config/webhooks.php
'dashboard' => [
'source_model' => \Pushery\Webhooks\Search\SearchableWebhookDelivery::class,
],

SearchableWebhookDelivery and SearchableWebhookCall are ready-made subclasses that carry the Scout trait. If you already read the log through a model of your own, apply Pushery\Webhooks\Search\SearchableDelivery or SearchableCall to that model instead — the traits are the same thing without the subclass.

What is indexed, and what is not

Only queryable, non-sensitive fields. Both logs index the event type, the status, the timestamp and a payload excerpt capped at search.payload_excerpt_chars (500 by default). What differs is the field each one is scoped by, because the two logs answer to different owners:

  • Outbound deliveries carry the tenant: owner_type and owner_id, the whole morph pair, so two tenants sharing an id under different owner types are not conflated. The endpoint url is indexed as well. Scope a query with searchForOwner($ownerType, $ownerId, $query).
  • Inbound calls carry the producer instead: source. There is no owner or tenant column on this log at all, so a tenant-scoped query has nothing to filter on here. Scope a query with searchForSource($source, $query).

A payload offloaded to a Storage disk is never indexed verbatim — its excerpt is left empty, so a large body is not copied into the index.

An index is not a screen

On every screen the payload is governed per request by the view-webhook-payload ability. An index has no such request and no such reader, so anything copied into it is readable by anyone who can query the engine. Keep the excerpt short, and constrain every query by the scoping field of the log you are querying — the owner pair outbound, the source inbound. The two shipped helpers named above do exactly that.