You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 29, 2026. It is now read-only.
[](https://packagist.org/packages/mradder/filament-logger)
Audit activity inside Filament using [spatie/laravel-activitylog](https://spatie.be/docs/laravel-activitylog).
13
9
14
-
Configurable activity logger for filament.
15
-
Powered by `spatie/laravel-activitylog`
10
+
This package gives you a ready-made Filament activity log resource plus automatic logging for resource changes, selected models, auth activity, and notifications.
16
11
17
-
## Features
18
-
You can choose what you want to log and how to log it.
19
-
- Log Filament Resource Events
20
-
- Log Login Event
21
-
- Log Notification Events
22
-
- Log Model Events
23
-
- Easily extendable to log custom events
12
+
## Highlights
24
13
25
-
Note: By default this package will log Filament Resource Events, Access(Login) Events, and Notification Events. If you want to log a model that is not a FilamentResource you will have to manually register in the config file.
14
+
- Filament activity log resource with searchable filters and a structured diff view
15
+
- Resource and model lifecycle logging, including create, update, delete, restore, force-delete, and replicate flows
16
+
- Auth event logging for login, logout, failed login, lockout, password reset, and 2FA recovery usage
17
+
- Notification logging
18
+
- Sensitive data redaction, anonymized IP logging, and stricter authorization defaults
19
+
- Configurable ignored fields per model and per resource
20
+
- Built-in pruning command for retention by age and log name
26
21
27
-
## Installation
22
+
## Requirements
28
23
29
-
| Plugin Version | Filament Version |
30
-
|----------------|------------------|
31
-
| < 0.5.x | ^2.11 |
32
-
| >= 0.6.0 | 3.x |
24
+
| Package | Version |
25
+
|---|---|
26
+
| PHP |`^8.4`|
27
+
| Filament |`^3.0`|
28
+
| Laravel contracts |`^11.0` or `^12.0`|
33
29
34
-
This package uses [spatie/laravel-activitylog](https://spatie.be/docs/laravel-activitylog), instructions for its setup can be found [here](https://spatie.be/docs/laravel-activitylog/v4/installation-and-setup)
30
+
## Installation
35
31
36
-
You can install the package via composer:
32
+
Install the package:
37
33
38
34
```bash
39
35
composer require mradder/filament-logger
40
36
```
41
-
After that run the install command:
37
+
38
+
Publish the package config and the Spatie activity log migrations:
42
39
43
40
```bash
44
41
php artisan filament-logger:install
45
42
```
46
-
This will publish the config & migrations from `spatie/laravel-activitylog`
47
43
48
-
For Filament v3, you need to register a resource in PanelProvider
44
+
Run your migrations:
45
+
46
+
```bash
47
+
php artisan migrate
48
+
```
49
+
50
+
Register the activity log resource in your panel provider:
51
+
49
52
```php
53
+
use Filament\Panel;
54
+
50
55
public function panel(Panel $panel): Panel
51
56
{
52
57
return $panel
53
58
->resources([
54
-
config('filament-logger.activity_resource')
59
+
config('filament-logger.activity_resource'),
55
60
]);
56
61
}
57
62
```
63
+
58
64
## Authorization
59
-
`ActivityResource` now uses strict authorization by default. If there is no registered policy, or the policy does not implement `viewAny` / `view`, the log resource is denied instead of falling back to Filament's permissive default.
60
65
61
-
After generating a policy, register `Spatie\Activitylog\Models\Activity` to use that policy in the AuthServiceProvider.
66
+
The activity log resource is intentionally strict by default.
67
+
68
+
If no policy is registered for the activity model, or the policy does not implement `viewAny` and `view`, the resource is denied instead of falling back to Filament's permissive default behavior.
69
+
70
+
After generating a policy, register it in your auth service provider:
71
+
62
72
```php
63
73
<?php
64
-
74
+
65
75
namespace App\Providers;
66
-
76
+
67
77
use App\Policies\ActivityPolicy;
68
78
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
69
79
use Spatie\Activitylog\Models\Activity;
70
-
80
+
71
81
class AuthServiceProvider extends ServiceProvider
72
82
{
73
83
protected $policies = [
74
-
// Update `Activity::class` with the one defined in `config/activitylog.php`
75
84
Activity::class => ActivityPolicy::class,
76
85
];
77
-
//...
78
86
}
79
87
```
80
-
> If you are using [Shield](https://filamentphp.com/plugins/shield) just register the ActivityPolicy generated by it
81
88
82
-
If you need the previous behavior for a legacy install, you can disable strict policy enforcement:
89
+
If you use a custom activity model in `config/activitylog.php`, map that model instead.
90
+
91
+
If you need the old behavior for a legacy install:
83
92
84
93
```php
85
94
'authorization' => [
86
95
'strict' => false,
87
96
],
88
97
```
89
98
90
-
## Security defaults
91
-
This package now applies a few safer defaults out of the box:
99
+
## What Gets Logged
100
+
101
+
Out of the box the package logs:
92
102
93
-
-`ActivityResource` requires explicit policy methods when `authorization.strict` is enabled.
94
-
- Sensitive keys such as passwords, tokens, secrets, and recovery codes are redacted before being stored in activity properties.
95
-
- Access logs anonymize IP addresses and trim user agents by default.
96
-
- Notification recipients are not logged unless `notifications.log_recipient` is explicitly enabled.
103
+
- Filament resource model events
104
+
- auth/access activity
105
+
- notification events
97
106
98
-
Example overrides:
107
+
If you want to log additional non-resource models, register them in `filament-logger.models.register`.
108
+
109
+
## Default Privacy and Security Behavior
110
+
111
+
The package ships with a few safer defaults:
112
+
113
+
- sensitive keys such as passwords, tokens, secrets, and recovery codes are redacted before storage
114
+
- access logs anonymize IP addresses
115
+
- user agents are trimmed
116
+
- notification recipients are not logged unless explicitly enabled
117
+
- the activity resource requires explicit policies when strict authorization is enabled
118
+
119
+
Example privacy-related overrides:
99
120
100
121
```php
101
122
'redacted_placeholder' => '[REDACTED]',
@@ -113,40 +134,144 @@ Example overrides:
113
134
],
114
135
```
115
136
116
-
## Translations
117
-
Publish the translations using:
137
+
## Configuration Guide
138
+
139
+
### Resource Logging
140
+
141
+
Resource observers are enabled by default and can ignore noisy attributes globally, per model, or per Filament resource:
The main `Activity` class being used by the Filament Resource instance will be resolved by Spatie's service provider, which loads the model defined by the configuration key found at `activitylog.activity_model` in `config/activitylog.php`.
0 commit comments