<?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: chris wilson</title>
    <description>The latest articles on DEV Community by chris wilson (@chris_wilson_853af3e53b1f).</description>
    <link>https://dev.to/chris_wilson_853af3e53b1f</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.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3814746%2F995ae9a9-2bb8-4d84-ad9f-3cd45fcbd398.gif</url>
      <title>DEV Community: chris wilson</title>
      <link>https://dev.to/chris_wilson_853af3e53b1f</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/chris_wilson_853af3e53b1f"/>
    <language>en</language>
    <item>
      <title>I Gave My Home SOC a Local Gemma 4 Analyst</title>
      <dc:creator>chris wilson</dc:creator>
      <pubDate>Fri, 08 May 2026 02:38:16 +0000</pubDate>
      <link>https://dev.to/chris_wilson_853af3e53b1f/i-gave-my-home-soc-a-local-gemma-4-analyst-18bb</link>
      <guid>https://dev.to/chris_wilson_853af3e53b1f/i-gave-my-home-soc-a-local-gemma-4-analyst-18bb</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for the &lt;a href="https://dev.to/challenges/google-gemma-2026-05-06"&gt;Gemma 4 Challenge: Build with Gemma 4&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Built
&lt;/h2&gt;

&lt;p&gt;I built &lt;strong&gt;NetGuard Gemma 4 Local SOC Analyst&lt;/strong&gt;, a local-first cybersecurity demo that uses Gemma 4 as an analyst for sanitized security telemetry.&lt;/p&gt;

&lt;p&gt;Most security dashboards tell you what fired.&lt;/p&gt;

&lt;p&gt;They do not always tell you what happened.&lt;/p&gt;

&lt;p&gt;This project takes a block of sanitized Suricata/Wazuh-style logs and asks Gemma 4 to connect the events into a structured incident report. Instead of treating every alert as an isolated line, the model reads the event window and returns:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;incident summary&lt;/li&gt;
&lt;li&gt;severity&lt;/li&gt;
&lt;li&gt;confidence&lt;/li&gt;
&lt;li&gt;attack chain&lt;/li&gt;
&lt;li&gt;timeline&lt;/li&gt;
&lt;li&gt;indicators of compromise&lt;/li&gt;
&lt;li&gt;triage recommendations&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The goal is to give a small SOC workflow a local analyst layer: something that can read noisy telemetry, connect related events, and produce a usable incident report without sending sensitive logs to a hosted model.&lt;/p&gt;

&lt;h2&gt;
  
  
  Demo
&lt;/h2&gt;

&lt;p&gt;The local demo includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;GET /&lt;/code&gt; health check&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;POST /analyze&lt;/code&gt; for single-event analysis&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;POST /analyze-logs&lt;/code&gt; for the main log-autopsy workflow&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;GET /ui&lt;/code&gt; for a simple browser demo&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;GET /sample-logs&lt;/code&gt; for sanitized sample telemetry&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Demo flow:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Start the local FastAPI server.&lt;/li&gt;
&lt;li&gt;Open the &lt;code&gt;/ui&lt;/code&gt; page.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Load sample logs&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Analyze logs&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Gemma 4 returns a structured incident report.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The sample log window includes a multi-stage pattern:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;TCP scan&lt;/li&gt;
&lt;li&gt;SQL injection-style probe&lt;/li&gt;
&lt;li&gt;SSH brute force attempts&lt;/li&gt;
&lt;li&gt;successful login&lt;/li&gt;
&lt;li&gt;privileged payload download&lt;/li&gt;
&lt;li&gt;script execution&lt;/li&gt;
&lt;li&gt;outbound shell behavior&lt;/li&gt;
&lt;li&gt;suspicious root-level user creation&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The important part is that Gemma 4 is asked to connect the sequence, not just summarize one alert.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Demo video:&lt;/strong&gt; Silent walkthrough showing the GitHub repo, local NetGuard UI, sanitized sample logs, and Gemma 4 structured incident output.&lt;/p&gt;

&lt;p&gt;GitHub Release: &lt;a href="https://github.com/cbw29512/GeminiHackathon/releases/tag/demo-v1" rel="noopener noreferrer"&gt;https://github.com/cbw29512/GeminiHackathon/releases/tag/demo-v1&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Code
&lt;/h2&gt;

&lt;p&gt;Repository:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/cbw29512/GeminiHackathon" rel="noopener noreferrer"&gt;https://github.com/cbw29512/GeminiHackathon&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Core files:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;main.py&lt;/code&gt; — FastAPI routes and local API guardrails&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;services/llm_analyzer.py&lt;/code&gt; — Gemma 4 prompt and response parsing logic&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;services/schemas.py&lt;/code&gt; — Pydantic schemas for validated output&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;scripts/sanitize_logs.py&lt;/code&gt;—sanitizer for SOC-shaped logs&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;templates/index.html&lt;/code&gt; — minimal local web UI&lt;/li&gt;
&lt;li&gt;`tests/ "— validation tests&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The project passed its final local audit with: ** 11 passed**.&lt;/p&gt;

&lt;p&gt;I also added guardrails so oversized log windows are rejected before being sent into local inference.&lt;/p&gt;

&lt;h2&gt;
  
  
  How I Used Gemma 4
&lt;/h2&gt;

&lt;p&gt;I used &lt;strong&gt;Gemma 4 E4B Q8_0&lt;/strong&gt; locally through Ollama.&lt;/p&gt;

&lt;p&gt;Gemma 4 is the core reasoning engine of the project. It is not being used only for copywriting or generic chatbot responses.&lt;/p&gt;

&lt;p&gt;The main endpoint is &lt;code&gt;POST /analyze-logs&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;That endpoint sends Gemma 4 a sanitized log window and asks it to return a strict JSON incident report containing:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;incident_summary&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;severity&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;confidence&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;attack_chain&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;timeline&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;iocs&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;triage_recommendations&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I chose the E4B model because this project needs local reasoning over security logs, not a huge hosted model. The goal was to keep the system practical on local hardware while still using Gemma 4 for the central analysis task.&lt;/p&gt;

&lt;h2&gt;
  
  
  Privacy And Local-First Design
&lt;/h2&gt;

&lt;p&gt;Security logs can expose internal IPs, usernames, hostnames, and network behavior.&lt;/p&gt;

&lt;p&gt;That is why this project is designed around local inference and sanitized input.&lt;/p&gt;

&lt;p&gt;The sanitizer preserves useful event structure while replacing sensitive values. This lets the model reason over realistic telemetry without exposing private data in the demo.&lt;/p&gt;

&lt;p&gt;The local-first design uses:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;FastAPI on &lt;code&gt;127.0.0.1&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Ollama for local model runtime&lt;/li&gt;
&lt;li&gt;Pydantic for schema validation&lt;/li&gt;
&lt;li&gt;sanitized sample logs&lt;/li&gt;
&lt;li&gt;no committed model binary&lt;/li&gt;
&lt;li&gt;no committed secrets&lt;/li&gt;
&lt;li&gt;no committed raw captures&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What I Learned
&lt;/h2&gt;

&lt;p&gt;The strongest version of this project was not single-alert analysis.&lt;/p&gt;

&lt;p&gt;The stronger idea was log-window autopsy.&lt;/p&gt;

&lt;p&gt;A single alert can tell you something suspicious happened. A sequence of events can tell you the story of the incident.&lt;/p&gt;

&lt;p&gt;That is where Gemma 4 became valuable: reading multiple related events and turning them into an analyst-style report.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Would Build Next
&lt;/h2&gt;

&lt;p&gt;Next, I would extend the UI into a richer NetGuard dashboard panel with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;upload support for local sanitized logs&lt;/li&gt;
&lt;li&gt;side-by-side raw alert stream and Gemma incident report&lt;/li&gt;
&lt;li&gt;exportable analyst reports&lt;/li&gt;
&lt;li&gt;confidence notes for each attack-chain stage&lt;/li&gt;
&lt;li&gt;larger event windows&lt;/li&gt;
&lt;li&gt;human review notes for triage decisions&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;This project is about giving a small SOC workflow a local analyst brain.&lt;/p&gt;

&lt;p&gt;Gemma 4 reads the evidence window, connects the related activity, and returns a structured report that a defender can actually use.&lt;/p&gt;

&lt;p&gt;That is the heart of the build.&lt;/p&gt;

</description>
      <category>devchallenge</category>
      <category>gemmachallenge</category>
      <category>gemma</category>
      <category>cybersecurity</category>
    </item>
  </channel>
</rss>
