---
title: "Privacy-Safe Phoenix Socket and Channel Logging Without Exposing Payloads"
url: https://daily.dev/posts/privacy-safe-phoenix-socket-and-channel-logging-without-exposing-payloads-eehbwgr28
source_url: https://hfiguera.github.io/obscura/blog/privacy-safe-phoenix-realtime-logging
type: article
source: "ElixirStatus"
published: 2026-08-14T18:17:51.744Z
updated: 2026-08-14T18:18:18.767Z
tags: ["webdev", "logging", "data-privacy", "elixir"]
reading_time: 13
upvotes: 3
comments: 0
language: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Privacy-Safe Phoenix Socket and Channel Logging Without Exposing Payloads

**[ElixirStatus](https://daily.dev/sources/elixirstatus)** · 13 min read · 3 upvotes · 0 comments

## Summary

An open-source Elixir library called Obscura introduces two opt-in telemetry handlers, Obscura.Phoenix.SocketLogger and Obscura.Phoenix.ChannelLogger, that restore operational visibility for Phoenix sockets and channels after disabling Phoenix's default logger, without exposing raw client-controlled payloads. Connection, join, and event parameters default to omission; topics are represented by configured patterns rather than raw values; incoming event names must appear on a startup allowlist; and optional bounded, fast-profile redaction and a single validated UUID correlation assign are available. Malformed or oversized values fail closed to fixed safe labels instead of falling back to raw data, and startup fails if Phoenix's default logger handler remains attached alongside the replacement.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://hfiguera.github.io/obscura/blog/privacy-safe-phoenix-realtime-logging>

## Questions this post answers

### How can I log Phoenix socket and channel telemetry without leaking client payloads and PII?

Disable Phoenix's default telemetry logger with config :phoenix, :logger, false, then supervise opt-in replacement handlers such as Obscura.Phoenix.SocketLogger and Obscura.Phoenix.ChannelLogger. These default connection, join, and event parameters to [OMITTED], represent topics as configured patterns instead of raw values, and require incoming event names to appear in a startup allowlist, with malformed values failing to fixed safe labels rather than raw output.

_daily.dev surfaces patterns like this for teams designing safer observability around real-time Elixir systems._

### Why shouldn't I run Phoenix's default logger alongside a custom sanitized telemetry handler?

Running both simultaneously is unsafe because one record could be correctly sanitized while the other still emits the original raw value from the same event, defeating the privacy goal entirely. Each Obscura Phoenix logger explicitly refuses to start if the corresponding default Phoenix.Logger handler remains attached to the same telemetry events, forcing an intentional single source of truth.

_Developers hardening logging pipelines can track these architectural tradeoffs on daily.dev._

### How do you correlate Phoenix channel join and event logs without logging the full socket state?

Configure a narrow correlation option that includes exactly one socket assign, restricted to a canonical UUID string, only when a join succeeds or an event is handled, the assign exists, and the metadata key is a bounded static identifier without PII. Note that an assign set inside join/3 itself won't appear on the join record since join telemetry captures the socket state before join/3 executes, but it will appear on later handled-event records.

_daily.dev helps engineers researching realtime logging correlation techniques compare implementation tradeoffs._

## Similar posts on daily.dev

- [Privacy-Safe Phoenix Request Logging Without Changing Controller Params](https://daily.dev/posts/privacy-safe-phoenix-request-logging-without-changing-controller-params-xmxxxyais) · ElixirStatus · 0 upvotes · 0 comments
- [Protecting PII in Elixir Before It Reaches Logs, APIs, and LLMs](https://daily.dev/posts/protecting-pii-in-elixir-before-it-reaches-logs-apis-and-llms-lkpcth0ab) · ElixirStatus · 0 upvotes · 0 comments

---

Tags: [#webdev](https://daily.dev/tags/webdev), [#logging](https://daily.dev/tags/logging), [#data-privacy](https://daily.dev/tags/data-privacy), [#elixir](https://daily.dev/tags/elixir)

[View this post on daily.dev](https://daily.dev/posts/privacy-safe-phoenix-socket-and-channel-logging-without-exposing-payloads-eehbwgr28)
