# Monitoring

This document covers observability points for operating Turista in production.

## Logs

Laravel logs to `storage/logs/laravel.log` by default. Tail logs in real time:

```bash
tail -f storage/logs/laravel.log
```

For production, forward logs to a centralized system such as ELK, Datadog, or CloudWatch.

## Audit log

OwenIt Auditing writes model changes to the `audits` table. You can query it to trace:

- Who created or updated a record.
- What values changed.
- When the change occurred.

Example:

```sql
SELECT * FROM audits WHERE auditable_type = 'App\\Models\\Reservation' AND auditable_id = 123 ORDER BY created_at DESC;
```

Note: password hashes are excluded from audit logs via `User::$auditExclude`.

## Queue monitoring

Monitor queue health by:

- Checking worker processes are running.
- Watching queue table or Redis list length.
- Setting up alerts for failed jobs in `failed_jobs`.

## Health check

`routes/web.php` exposes a simple health-check endpoint at `/`:

```http
GET /
```

A `200 OK` response indicates the application is reachable.

## Scheduler monitoring

Ensure the cron entry is active:

```bash
crontab -l
```

Verify scheduler activity in logs.

## Error tracking

Consider integrating an error-tracking service such as Sentry, Bugsnag, or Flare to capture production exceptions.

## Performance

- Keep `config`, `route`, and `view` caches enabled in production.
- Monitor slow queries on the `unit_availabilities` and `reservations` tables.
- Review the performance indexes added by recent migrations.
