<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Leo</title>
    <description>The latest articles on DEV Community by Leo (@allmightyleobyte).</description>
    <link>https://dev.to/allmightyleobyte</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4180175%2F078c0a38-49c9-4ccd-b5cc-0328d1617558.png</url>
      <title>DEV Community: Leo</title>
      <link>https://dev.to/allmightyleobyte</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/allmightyleobyte"/>
    <language>en</language>
    <item>
      <title>Stop pasting raw logs into ChatGPT</title>
      <dc:creator>Leo</dc:creator>
      <pubDate>Mon, 12 Oct 2026 18:34:27 +0000</pubDate>
      <link>https://dev.to/allmightyleobyte/stop-pasting-raw-logs-into-chatgpt-1nic</link>
      <guid>https://dev.to/allmightyleobyte/stop-pasting-raw-logs-into-chatgpt-1nic</guid>
      <description>&lt;p&gt;You know the workflow. Something breaks, you grab the log, paste it into ChatGPT or Copilot, and ask what went wrong. It works. The AI spots the pattern in seconds.&lt;/p&gt;

&lt;p&gt;Here is the part nobody likes to think about. That log contains your internal IP scheme, user principal names, SIDs, maybe a bearer token someone left in a header. You just handed all of it to a third party. Most of us have done it. I wanted a small habit that makes it safer.&lt;/p&gt;

&lt;p&gt;The idea is simple: make a redacted copy first, paste that instead. But dumb redaction breaks troubleshooting. If every IP becomes [REDACTED], the AI cannot tell which server talked to which, and the whole exercise falls apart. So each distinct value gets its own stable token. 10.0.4.21 becomes [IP-1] everywhere it appears. &lt;a href="mailto:jdoe@contoso.com"&gt;jdoe@contoso.com&lt;/a&gt; becomes [UPN-1]. The AI can still follow the story from box to box. It just cannot see your network.&lt;/p&gt;

&lt;h2&gt;
  
  
  What it catches
&lt;/h2&gt;

&lt;p&gt;IPv4 and IPv6 addresses, email addresses and UPNs, DOMAIN\user names, GUIDs, SIDs, JWTs, bearer tokens, Basic auth headers, API keys, JSON secrets (passwords, tokens, client secrets), Azure SAS signatures, storage account keys. If your logs have their own formats like customer reference numbers, you can pass your own regex and those get stable tokens too.&lt;/p&gt;

&lt;p&gt;A quick before and after. Say your log has this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;2026-10-12 01:14:22 ERROR Auth failed for jdoe@contoso.com from 10.0.4.21, token eyJhbGciOi...
2026-10-12 01:14:23 WARN  Retry from 10.0.4.21 for jdoe@contoso.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The sanitized copy reads:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;2026-10-12 01:14:22 ERROR Auth failed for [UPN-1] from [IP-1], token [TOKEN-1]
2026-10-12 01:14:23 WARN  Retry from [IP-1] for [UPN-1]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Timestamps and error messages are untouched, so the AI can still diagnose. The values are gone, but the relationships between them survive. That is the whole trick.&lt;/p&gt;

&lt;h2&gt;
  
  
  The script
&lt;/h2&gt;

&lt;p&gt;Single file, no modules, works on PowerShell 5.1 and 7.x. Originals are never modified. Redacted copies go to a Sanitized folder next to the input. It prints a redaction map so you can trace tokens back later, and with -SaveMap it writes the map to a file. Keep that map local. Never share it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="n"&gt;Protect-LogFile&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-Path&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;'C:\Cases\INC123\*.log'&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add your own patterns:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="n"&gt;Protect-LogFile&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-Path&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;'.\firewall.log'&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-CustomPatterns&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;'CustomerRef-\d{6}'&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or flatten everything to one token with no map:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="n"&gt;Protect-LogFile&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-Path&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;'.\firewall.log'&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-ReplacementToken&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;'[REDACTED]'&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It supports -WhatIf like a well behaved cmdlet, validates your custom regex before writing anything, and never silently overwrites a previous run. The full script is in the free download linked below.&lt;/p&gt;

&lt;p&gt;Two honest caveats. Regex redaction is a safety net, not a guarantee. Review the redacted copy before you share it, especially if your logs contain hostnames or ticket IDs that identify a customer. Those need custom patterns. And four part version numbers like 4.8.4.0 look like IPv4 addresses to a regex, so skim the output when those appear.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why stable tokens instead of deletion
&lt;/h2&gt;

&lt;p&gt;I tried plain deletion first. The AI kept asking "which server?" and I kept re reading the original log to answer, which defeated the purpose. Stable tokens preserve the shape of the problem while removing the identity of the parts. In practice the AI diagnoses just as well from the tokenized copy, because troubleshooting is about relationships and sequences, not about the literal values.&lt;/p&gt;

&lt;h2&gt;
  
  
  Get it
&lt;/h2&gt;

&lt;p&gt;Full disclosure: I built this. It is free here: &lt;a href="https://mightyleo.gumroad.com/l/ojbhki" rel="noopener noreferrer"&gt;https://mightyleo.gumroad.com/l/ojbhki&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It is also one of ten tools in a bigger bundle I sell for $19: thirty environment aware prompts, ten PowerShell tools, ten checklists, at &lt;a href="https://mightyleo.gumroad.com/l/ai-playbook-for-it-engineers" rel="noopener noreferrer"&gt;https://mightyleo.gumroad.com/l/ai-playbook-for-it-engineers&lt;/a&gt;. The sanitizer stays free regardless. If the script misses a pattern in your logs, tell me in the comments and I will add it.&lt;/p&gt;

</description>
      <category>powershell</category>
      <category>showdev</category>
      <category>security</category>
      <category>ai</category>
    </item>
  </channel>
</rss>
