Terminal CLI One-Liner (Flat Regex):
sed -E 's/(api_key|app_key|password|pass):\s*["\x27]?[^#\r\n"\x27]+/\1: "[REDACTED_DD_SECRET]"/g; s#(https?://[^:@/]+:)[^@/]+(@)#\1[REDACTED_PROXY_AUTH]\2#g' datadog.yamlβ οΈ Why Naive CLI / Regex Fails: Fails on multi-line YAML anchors (&default_init), corrupts nested instances[] arrays in conf.d/postgres.d/conf.yaml, and misses DD_API_KEY / ENC[...] secrets embedded inside extra_config_providers or process_config args.
π‘οΈ Pre-LLM & Ticket Safety: How to sanitize datadog.yaml and conf.d/postgres.d/conf.yaml before pasting into ChatGPT, Claude, or Cursor for Agent troubleshooting