> For the complete documentation index, see [llms.txt](https://docs.pharos.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.pharos.ai/platform-overview/pharos-platform-architecture/logs/log-processing.md).

# Log Processing

Learn how Pharos processes logs and what data is added to log records.

Log processing transforms raw error data into actionable intelligence. When Pharos captures a log—whether from an automated email, periodic mining, or platform event—it immediately begins enriching and organizing that data through a multi-stage pipeline designed to maximize troubleshooting efficiency.

## The Processing Pipeline

Every log that enters Pharos flows through a consistent processing pipeline:

```
Raw Capture → Parsing → Categorization → Fingerprinting → Enrichment → Storage
```

This pipeline ensures that by the time a log becomes visible in the Pharos UI, it contains all the context necessary for rapid diagnosis and resolution.

| Stage              | Purpose                        | Output                                  |
| ------------------ | ------------------------------ | --------------------------------------- |
| **Raw Capture**    | Collect error from source      | Raw error data                          |
| **Parsing**        | Extract structured information | Error type, message, context            |
| **Categorization** | Identify log type              | Apex, Flow, Bulk API, etc.              |
| **Fingerprinting** | Extract stable signature       | Unique pattern for grouping             |
| **Enrichment**     | Add contextual metadata        | User info, records, limits, audit trail |
| **Storage**        | Persist to custom objects      | Queryable log record                    |

## What Processing Adds

Raw Salesforce errors are minimal—often just a message and a line number. Pharos processing augments this sparse data with multiple layers of intelligence:

**Structural Organization**

Pharos identifies what type of error occurred (Apex, Flow, Bulk API, and other built-in categories) and categorizes it accordingly. This categorization drives how the log is presented visually, what fields are populated, and how it can be queried.

**Pattern Recognition**

Through fingerprinting, Pharos extracts the invariant signature of an error—the parts that remain constant across occurrences. A null pointer exception on line 156 of `OpportunityTriggerHandler` has the same fingerprint whether it happens once or a thousand times, allowing Pharos to group logs into Issues intelligently.

**Contextual Metadata**

Raw errors lack information about who was affected, which records were involved, and what the system state was at the time of failure. Pharos enrichment queries Salesforce to capture:

* User details (who was impacted)
* Record snapshots (what data was involved)
* Governor limit consumption (resource usage at failure time)
* Audit trail changes (what changed recently)
* Relationship data (connected records)

**Visual Debugging Assets**

Different error types get specialized visual treatments:

* **Flow errors** → Reconstructed execution path with highlighted failed element
* **Apex errors** → Interactive stack traces with code context
* **Bulk API failures** → Aggregated success/failure counts with drill-down

## Why Processing Matters

Without processing, logs are just noise. With processing, they become a diagnostic goldmine.

### Before & After Comparison

| Aspect                 | Before Processing (Raw Email)             | After Processing (Pharos)           |
| ---------------------- | ----------------------------------------- | ----------------------------------- |
| **Error Info**         | "System.NullPointerException at line 156" | Same + stack trace + code context   |
| **User Context**       | Developer must manually find user         | User details automatically attached |
| **Record Data**        | Must locate record, check fields          | Record snapshot at failure time     |
| **Recent Changes**     | Must review audit trail                   | Correlated changes highlighted      |
| **System State**       | Must guess governor limits                | Limit consumption captured          |
| **Investigation Time** | **30+ minutes**                           | **\~3 minutes**                     |

{% hint style="success" %}
**Impact at Scale:** This 10x acceleration in troubleshooting compounds across hundreds or thousands of errors, transforming reactive firefighting into proactive system health management.
{% endhint %}

## Processing Architecture

Pharos processing happens asynchronously to avoid impacting transaction performance. Platform events act as the queueing mechanism—when a log is captured, its data is published as an event, consumed by a background subscriber, processed, and persisted.

**Async processing flow:**

```
Error Occurs → Platform Event Published → Background Subscriber → Processing Pipeline → Storage
```

**Key architectural benefits:**

* **Zero User Impact** - Processing happens in background, doesn't slow transactions
* **High Throughput** - Handles hundreds of logs per minute
* **Graceful Degradation** - Events queue during high load, process when capacity available
* **Low Latency** - Typically 1-5 seconds from error to processed log

{% hint style="info" %}
**Resilient by Design:** Even during extreme load (thousands of simultaneous errors), the platform event queue ensures logs are processed without data loss or transaction impact.
{% endhint %}

## Explore Processing Topics

<table data-view="cards"><thead><tr><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><strong>🔄 Log Lifecycle</strong></td><td>The log processing flow from the moment a log is entered through different entry points.</td><td><a href="https://docs.pharos.ai/platform-overview/pharos-platform-architecture/logs/log-processing/log-lifecycle.md">Log Lifecycle</a></td></tr><tr><td><strong>🏷️ Categorization</strong></td><td>How Pharos categorizes and organizes raw log data.</td><td><a href="https://docs.pharos.ai/platform-overview/pharos-platform-architecture/logs/log-processing/categorization.md">Categorization</a></td></tr><tr><td><strong>🧬 Log Fingerprinting</strong></td><td>The fingerprinting mechanism used for different Salesforce technologies.</td><td><a href="https://docs.pharos.ai/platform-overview/pharos-platform-architecture/logs/log-processing/log-fingerprinting.md">Log Fingerprinting</a></td></tr><tr><td><strong>🌟 Log Enrichment</strong></td><td>What data is added to log records during enrichment, and why it's useful.</td><td><a href="https://docs.pharos.ai/platform-overview/pharos-platform-architecture/logs/log-processing/log-enrichment.md">Log Enrichment</a></td></tr></tbody></table>
