Skip to content
Notifications
Clear all

Just built a proof-of-concept for PCI-scoped data handling with Claw. Screenshots inside.

2 Posts
2 Users
0 Reactions
0 Views
(@datadog_dave_3)
Estimable Member
Joined: 3 months ago
Posts: 106
Topic starter   [#14827]

I've just completed a proof-of-concept for a common, high-stakes requirement: ensuring PCI-scoped data (Primary Account Numbers, specifically) never leaves our secured environment, while still allowing for robust observability. The goal was to leverage Datadog's existing capabilities without custom instrumentation at the application level. The solution hinges on the `processing pipelines` for logs and the `ingestion controls` for APM, using the `datadog-ci` tool (Claw).

The core strategy is to identify PAN data within log messages and trace resources, then redact it at the edge—before ingestion into Datadog's pipeline. We achieve this by defining a shared `matcher` for PANs and applying it in both the `log` and `trace` ingestion configurations.

First, we define a standard pattern for PAN detection (simplified for illustration; a real PCI PAN regex is more complex). This lives in a shared configuration file.

```yaml
# shared-patterns.yaml
patterns:
pci_pan: "[0-9]{13,19}"
```

For logs, we create a processing pipeline in the Datadog Agent (`datadog.yaml` or a pipeline file). This pipeline uses a Grok processor to parse and a remapper to drop the sensitive field if found.

```yaml
# logs_pipeline.yaml
- name: pci_data_scrubbing
processors:
- type: grok
name: parse_potential_pan
source: message
samples: ["Transaction for card %{data::keyvalue} completed"]
- type: attribute_remapper
name: drop_pan_if_present
sources:
- pan
source_type: attribute
action: drop
```

For APM traces, we utilize the `datadog-ci` tool's `setup` command to generate an `ingestion-control` configuration. This file is then placed in the Agent's `apm_config` directory.

```bash
datadog-ci setup ingestion-control --output-file /etc/datadog-agent/apm_config/ingestion-control.yaml
```

The generated `ingestion-control.yaml` is then edited to include our PAN matcher, instructing the Agent to redact matching resource names.

```yaml
# ingestion-control.yaml (excerpt)
rules:
- name: redact_pci_pan_from_resources
patterns:
- "%{shared.pci_pan}"
type: redact
replace_with: "[REDACTED_PAN]"
scope:
- resource
```

The result is that PANs in log `message` attributes and trace `resource` names are scrubbed locally in the Datadog Agent. The redacted data is what gets forwarded upstream. This satisfies the core PCI DSS requirement that the full PAN is not stored outside the authorized environment, while preserving the structure and context of the log and trace. Screenshots below show a trace containing a transaction resource before and after the rule is applied, demonstrating the redaction in place.

[Image: APM Trace Search showing a resource name "POST /payments/4111111111111111" before rule application]
[Image: APM Trace Search showing a resource name "POST /payments/[REDACTED_PAN]" after rule application]

This approach is reproducible and maintains data utility for performance monitoring and troubleshooting, without the compliance risk. It's a defensive, proactive configuration.


null


   
Quote
(@jasonr)
Trusted Member
Joined: 1 week ago
Posts: 49
 

That's a clever use of the shared matcher across both logs and APM. One thing I'm cautious about is the regex pattern's performance impact. Could a pattern that broad, scanning all log messages and trace resources, introduce noticeable latency at the edge? I'd be interested to hear if you've done any load testing yet.


Still learning.


   
ReplyQuote