# `AshAuthentication.AddOn.AuditLog`
[🔗](https://github.com/team-alembic/ash_authentication/blob/main/lib/ash_authentication/add_ons/audit_log.ex#L5)

Audit logging support.

Provides audit-logging support for authentication strategies by adding changes and preparations to all their actions.

In order to use this add-on you must have at least one resource configured with the `AshAuthentication.AuditLogResource` extension added.

## Example

```elixir
defmodule MyApp.Accounts.User do
  use Ash.Resource,
    extensions: [AshAuthentication],
    domain: MyApp.Accounts

  authentication do
    add_ons do
      audit_log do
        audit_log_resource MyApp.Accounts.AuditLog
      end
    end
  end
end
```

Request metadata uses `conn.remote_ip` for `remote_ip`, so proxy-aware plugs
can rewrite it from forwarded/proxy metadata before AshAuthentication runs.

# `t`

```elixir
@type t() :: %AshAuthentication.AddOn.AuditLog{
  __spark_metadata__: Spark.Dsl.Entity.spark_meta(),
  audit_log_resource: Ash.Resource.t(),
  exclude_actions: [atom()],
  exclude_strategies: [atom()],
  include_actions: [atom()],
  include_fields: [atom()],
  include_strategies: [atom()],
  ip_privacy_mode: :none | :hash | :truncate | :exclude,
  ipv4_truncation_mask: pos_integer(),
  ipv6_truncation_mask: pos_integer(),
  name: atom(),
  provider: :audit_log,
  resource: Ash.Resource.t()
}
```

---

*Consult [api-reference.md](api-reference.md) for complete listing*
