# Searching for errors and occurrences


Within the application, you can search for errors using the search bar at the top of the project errors page. By default, the search query will be `is:unresolved`, showing you the errors that are not resolved.

When opening an error, the error occurrences can also be searched. You'll open the search bar by clicking the 'show occurrences' button on an error.

We provide a dozen search directives like these to help you find errors and occurrences. Some of them even provide suggestions for subjects to search for.

Not sure what directives can be used? By pressing CTRL-TAB, a handy autocomplete will show up.

Some directives can only be used with the error search, some only with the occurrence search, and some with both. This will be indicated in the directive description.

## Search directives

Please note the values of directives cannot contain spaces. You can wrap the query with double quotes if you want to search for a value with spaces.

**class** - *errors/occurrences*

This directive allows you to search for the class name of the error or occurrence.

`class:QueryException` -> filters all QueryException errors or occurrences

**command** - *errors/occurrences*

It is possible to filter errors or occurrences triggered within commands:

- `command:db:seed` -> filters all errors or occurrences triggered within the db:seed command
- `command:"db:seed --class=UsersTableSeeder"` -> always wrap commands with spaces in double quotes

**env** - *errors/occurrences*

Filter errors or occurrences by environment:


`env:production` -> filters all errors or occurrences triggered in the production environment


**first_seen_at** - *errors*

Allows you only to show errors first seen at a specific time.


`first_seen_at:2020-05-16` -> filters all errors which were first seen on May 16th, 2020


It is also possible to extend the directive for a more fine-grained search:

- `first_seen_at:>2020-05-16 ` -> errors seen after May 16th, 2020
- `first_seen_at:>=2020-05-16` -> errors seen on or after May 16th, 2020
- `first_seen_at:<2020-05-16 ` -> errors seen before May 16th, 2020
- `first_seen_at:<=2020-05-16` -> errors seen on or before May 16th, 2020

A timestamp in UTC can also be provided:

`first_seen_at:>2020-05-16T12:00:00` -> filters all errors which were first seen after May 16th, 2020 at 12:00:00 UTC

**handled** - *errors*

Allows you to only show errors which were marked as handled for a provided percentage.

- `handled:>30 ` -> errors where more than 30% of the occurrences were marked as handled
- `handled:>=30` -> errors where 30% or more of the occurrences were marked as handled
- `handled:<30 ` -> errors where less than 30% of the occurrences were marked as handled
- `handled:<=30` -> errors where 30% or less of the occurrences were marked as handled

**is** - *errors/occurrences**

- `is:unresolved` -> only unresolved errors will be shown
- `is:resolved` -> only resolved errors will be shown
- `is:unsnoozed` -> only unsnoozed errors will be shown
- `is:snoozed` -> only snoozed errors will be shown
- `is:recent` -> only errors which were seen in the last 24 hours will be shown
- `is:handled` -> only errors which were marked as handled will be shown
- `is:unhandled` -> only errors which were not marked as handled will be shown

\* The unresolved, resolved, snoozed & unsnoozed directives are not available with occurrences.

**job** - *errors/occurrences*

Filter errors or occurrences by the job that triggered them.


`job:App\Jobs\DownloadVideo` -> filters all errors or occurrences triggered by the DownloadVideo job

**language** - *errors*

Filter errors by programming language (PHP or JS).


`language:PHP` -> filters all PHP errors

**last_seen_at** - *errors*

Allows you only to show errors that were last seen at a specific time.

The rules for this directive are the same as for the first_seen_at directive.

**level** - *errors*

Filter log messages by level.

`level:warning` -> filters all log messages with a warning level

**occurrence_count** - *errors*

Filter errors by the number of occurrences.

- `occurrence_count:>30` -> errors with more than 30 occurrences

When using this directive, the amount of occurrences currently present in Flare will be counted. Some errors might have a higher occurrence count beyond the default retention period. Filtering on the historic occurrence count can be done by using the `occurrence_count_historic` directive.

**priority** - *errors*

Filter errors by priority.

- `priority:info` -> filters all errors with an info priority
- `priority:low` -> filters all errors with a low priority
- `priority:medium` -> filters all errors with a medium priority
- `priority:high` -> filters all errors with a high priority
- `priority:none` -> filters all errors without a priority

**tracking_uuid** - *errors/occurrences*

Each error occurrence has a unique tracking UUID. You can use this directive to filter errors or occurrences by this UUID.

`tracking_uuid:f3b9c1b0-7b1f-11ea-8d77-0242ac130003` -> filters all errors or occurrences with this tracking UUID


**type** - *errors/occurrences*

Filter errors or occurrences by the type of entry point which triggered them.

- `type:web`
- `type:job`
- `type:command`

**url** - *errors/occurrences*

Filter errors or occurrences based upon which URL they were triggered on.

`url:https://flareapp.io` -> filters all errors or occurrences triggered on the Flare website

**user_id** - *errors/occurrences*

Filter errors or occurrences triggered by a user specified by its id,uuid, or ulid.

`user_id:1` -> filters all errors or occurrences triggered by the user with id 1

**user_email** - *errors/occurrences*

Filter errors or occurrences triggered by a user specified by its email address.

`user_email:info@spatie.be` -> filters all errors or occurrences triggered by the user with email info@spatie.be

**users_affected** - *errors*

Filter errors by the number of users affected.

- `users_affected:>30` -> errors which affected more than 30 users

**version** - *errors/occurrences*

When you send an application version to Flare, you can filter errors or occurrences by this version.

`version:2.0.0` -> filters all errors or occurrences which were triggered on version 2.0.0

## Without search directives

You're not always required to specify a directive. It is possible to type a search query with or without any directive, and Flare will search for the query in the error message, class, and entry point when searching for errors. When searching for occurrences, Flare will only search in the error message.

These queries without directives have some operations which allow for some more query finetuning:

### Wildcard: `*`

This will match any letter or number.

`Redis*` -> Will match RedisException and Redis

### Exclude: `-`

Minus will exclude the word from the search query. (note: another word should already be present before this operator can be used).

`connection -mysql` -> will match errors with connection in it but not MySQL

### Exact phrase: `'`

By wrapping a sentence in quotes, you can search for an exact match.

`'Connection refused'` -> will match errors with this exact sentence.

Which in the end, allows you to construct queries like this:

`is:unresolved is:unsnoozed 'Connection refused'` -> will match all unresolved and unsnoozed errors with the sentence 'Connection refused'
