<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Somuma on Medium]]></title>
        <description><![CDATA[Stories by Somuma on Medium]]></description>
        <link>https://medium.com/@somuma1074?source=rss-9735c756fa33------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*Rma6l0qmGpWkhcwH</url>
            <title>Stories by Somuma on Medium</title>
            <link>https://medium.com/@somuma1074?source=rss-9735c756fa33------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 27 Nov 2026 15:22:00 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@somuma1074/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Enterprise Invoice Automation & Security Suite]]></title>
            <link>https://medium.com/@somuma1074/enterprise-invoice-automation-security-suite-fd2e3a52b972?source=rss-9735c756fa33------2</link>
            <guid isPermaLink="false">https://medium.com/p/fd2e3a52b972</guid>
            <category><![CDATA[cybersecuruity]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[automaton]]></category>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[chatbots]]></category>
            <dc:creator><![CDATA[Somuma]]></dc:creator>
            <pubDate>Sat, 25 Jul 2026 09:29:45 GMT</pubDate>
            <atom:updated>2026-07-25T09:29:45.119Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S5FNAtnkvzigYOQh8T87KQ.png" /></figure><p>An n8n workflow that autonomously processes incoming invoices from Gmail — extracting data with AI, validating integrity through a triple-check audit system, detecting fraud, and requiring human approval before writing to the database.</p><p>Built as a production-ready, client-deployable system.</p><p>ARCHITECTUE<br> A[Gmail Trigger\n Polls every 5 min] → B[Extract Email Metadata]<br> B → C[LlamaParse\n Upload PDF]<br> C → D[Wait 10s]<br> D → E[LlamaParse\n Fetch Markdown]<br> E → F[Openrouter\n Extract JSON Fields]<br> F → G[Clean Output\n Parse JSON]<br> G → H{Gate 1: Invoice QA\nInvoice number present?}<br> H — No → I[Auto-Reply to Sender\nRequest resubmission]<br> H — Yes → J[Math Engine\nVerify totals and VAT]<br> J → K{Gate 2: Accuracy Check\nCalculations valid?}<br> K — No → L[Email Alert\nFlag to Finance Team]<br> K — Yes → M[Supabase\nLook up vendor]<br> M → N{New vendor?}<br> N — Yes → O[Register vendor\nin Supabase]<br> O → P[Supabase\nCheck for duplicate invoice]<br> N — No → P<br> P → Q{Gate 3: Fraud Check\nDuplicate found?}<br> Q — Yes → R[Slack Alert\nFRAUD/DUPLICATE WARNING]<br> Q — No → S[Slack HITL\nRequest human approval]<br> S → T[Insert to\nInvoice Database]<br> T → U[Update status\nAPPROVED]<br> U → V[Archive in Gmail\nRemove from INBOX]</p><h3>Features</h3><h3>Triple-Check Audit System</h3><p>Gate 1 — Quality Check Inspects the extracted JSON for a valid invoice_number. If missing or null, the workflow automatically replies to the sender with a formatted HTML email requesting a clean resubmission — no human involvement needed.</p><p>Gate 2 — Math Engine Custom JavaScript re-calculates:</p><ul><li>Expected total: subtotal + tax</li><li>Expected VAT: subtotal × 0.20 (configurable rate)</li></ul><p>Flags mismatches within a £0.05 tolerance and sends an alert to the finance team email. The invoice is paused until corrected.</p><p>Gate 3 — Fraud &amp; Duplicate Detection Cross-references the extracted invoice_number and vendor against the Supabase master ledger. Fires an immediate Slack alert on any duplicate — acting as a 24/7 financial sentry.</p><h3>Human-in-the-Loop (HITL)</h3><p>Uses n8n’s sendAndWait Slack node. The workflow pauses and will not write to the database until a designated approver clicks Approve in Slack. No invoice is committed without a human decision.</p><h3>Vendor Registry</h3><p>Automatically registers new vendors in a Supabase vendors table on first invoice receipt. Subsequent invoices from the same vendor skip registration and go straight to duplicate checking.</p><h3>Gmail Lifecycle Management</h3><p>Each invoice exits with the correct Gmail label regardless of outcome:</p><ul><li>Failed QA → labelled and archived</li><li>Math error → labelled and archived</li><li>Fraud detected → labelled and archived</li><li>Approved → labelled and archived</li></ul><p>Your inbox stays clean automatically.</p><h3>Error Resilience</h3><p>Every node has retryOnFail: true. A separate error-monitoring workflow (errorWorkflow) catches any execution failure and notifies the developer with a direct execution link — no silent failures.</p><h3>Tech Stack</h3><p>LayerToolWorkflow orchestrationn8nPDF parsingLlamaIndex LlamaParse APIAI extractionGoogle Gemini (via n8n LangChain nodes)DatabaseSupabase (PostgreSQL)Notifications &amp; HITLSlackEmail trigger &amp; managementGmail APIMath validationn8n Code node (JavaScript)</p><h3>Prerequisites</h3><ul><li>n8n instance (cloud or self-hosted)</li><li>LlamaIndex Cloud account (LlamaParse API key)</li><li>Google Gemini API key</li><li>Supabase project</li><li>Slack workspace with a dedicated channel</li><li>Gmail account connected via OAuth2</li></ul><h3>Supabase Schema</h3><p>Create two tables in your Supabase project before importing the workflow.</p><p>vendors table</p><pre>create table vendors (<br>  id uuid default gen_random_uuid() primary key,<br>  name text not null,<br>  created_at timestamptz default now()<br>);</pre><p>invoices table</p><pre>create table invoices (<br>  id uuid default gen_random_uuid() primary key,<br>  invoice_number text,<br>  total_amount numeric,<br>  currency text,<br>  vendor_name text,<br>  tax_amount numeric,<br>  raw_ai_output jsonb,<br>  status text default &#39;PENDING&#39;,<br>  created_at timestamptz default now()<br>);</pre><h3>Setup</h3><ol><li>Import the workflow</li></ol><ul><li>In n8n, go to Workflows → Import from file</li><li>Select workflow/invoice_automation.json</li></ul><ol><li>Configure credentials</li></ol><ul><li>Gmail OAuth2 — connect your Gmail account</li><li>Google Gemini (PaLM) API — add your Gemini API key</li><li>Supabase API — add your project URL and service role key</li><li>LlamaParse Header Auth — add Authorization: Bearer YOUR_LLAMAPARSE_KEY</li><li>Slack API — add your Slack bot token</li></ul><ol><li>Update workflow variables</li></ol><ul><li>Slack channel ID → your approval channel</li><li>Finance team email → your error alert recipient</li><li>Gmail label ID → create a label in Gmail and paste its ID (found via Gmail API or Settings)</li></ul><ol><li>Deploy error workflow</li></ol><ul><li>Create a separate n8n workflow to handle errors</li><li>Set its ID in the workflow settings under errorWorkflow</li></ul><ol><li>Activate the workflow</li></ol><h3>Customization</h3><p>ParameterDefaultHow to changePolling intervalEvery 5 minutesGmail Trigger node → pollTimesVAT rate20%Calculator node → net * 0.20Email filtersubject contains &quot;invoice&quot; or &quot;bill&quot;Gmail Trigger → filters.qDatabaseSupabaseReplace Supabase nodes with your preferred DBApproval channelSingle Slack channelRoute vendors to different channels via IF nodes</p><h3>Project Status</h3><p>Production-ready. Built and tested with live invoice data. Execution logs confirm successful end-to-end runs across all branches including fraud detection and HITL approval paths.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*UG8SlwqEE2KEfHPP.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fd2e3a52b972" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Windows Logging Pipeline with Sysmon, Winlogbeat, and the ELK Stack]]></title>
            <link>https://medium.com/@somuma1074/building-a-windows-logging-pipeline-with-sysmon-winlogbeat-and-the-elk-stack-79c0797fcc3a?source=rss-9735c756fa33------2</link>
            <guid isPermaLink="false">https://medium.com/p/79c0797fcc3a</guid>
            <dc:creator><![CDATA[Somuma]]></dc:creator>
            <pubDate>Tue, 05 May 2026 08:35:43 GMT</pubDate>
            <atom:updated>2026-05-05T08:35:43.865Z</atom:updated>
            <content:encoded><![CDATA[<p>In this project, I set out to simulate a lightweight but effective Security Information and Event Management (SIEM)-like pipeline using open-source tools. The goal was to monitor security-relevant activities on a Windows Server machine by forwarding its logs through a modern data ingestion and visualization stack.</p><p>Rather than building from scratch, I reused my Windows Server 2022 and Ubuntu virtual machines from my previous <strong>Microsoft Sentinel</strong> project. This decision saved setup time and helped maintain continuity in my learning workflow. I made sure to open the necessary network ports to facilitate communication between components:</p><ul><li>Port <strong>5044</strong> for Winlogbeat to forward logs to Logstash</li><li>Port <strong>9200</strong> for accessing Elasticsearch</li><li>Port <strong>5601</strong> for accessing Kibana</li><li>Port <strong>22</strong> and <strong>3389</strong> remained open for remote management</li></ul><h3>Project Architecture</h3><p><strong>Architecture Flow:</strong></p><p>Sysmon → Winlogbeat → Logstash → Elasticsearch → Kibana</p><p>Press enter or click to view image in full size</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*bgoJXHYg4Ly3izhb.png" /></figure><p>Data flow in the logging pipeline</p><p>This project follows a classic ELK-based logging architecture tailored for Windows environments:</p><ol><li><strong>Sysmon (System Monitor):</strong><br>This was the first tool installed on the Windows Server 2022 VM. Sysmon enhances Windows event logging by providing detailed information on process creation, network connections, and registry changes. It acts as a high-fidelity event generator, capturing the raw system activities that security analysts care about.</li><li><strong>Winlogbeat:</strong><br>Winlogbeat acts as the shipper. It reads the relevant Windows Event Logs, including those generated by Sysmon, and forwards them to Logstash. It is lightweight and specifically optimized for Windows event data.</li><li><strong>Logstash:</strong><br>Logstash acts as the parsing and transformation layer. It receives the structured logs from Winlogbeat, applies filtering rules, enriches them if necessary, and forwards the cleaned output to Elasticsearch.</li><li><strong>Elasticsearch:</strong><br>This is the core indexing engine. It stores all incoming logs from Logstash and makes them searchable in near real-time. Elasticsearch also powers the alerting and querying features.</li><li><strong>Kibana:</strong><br>Kibana sits on top of Elasticsearch and offers a powerful visual interface for exploring, querying, and analyzing the logs. Dashboards, Discover view, and visualizations are all made possible through Kibana.</li></ol><p>Together, this pipeline ensures that any meaningful activity on the monitored Windows machine is captured, transformed, indexed, and presented in a format suitable for threat hunting, detection engineering, o compliance auditing.</p><blockquote><strong><em>Note:</em></strong><em> Ports such as </em><em>9200 (Elasticsearch), </em><em>5601 (Kibana), and </em><em>5044 (Logstash Beats input) were opened to enable smooth communication across components. The infrastructure reused the same Ubuntu (for hosting ELK) and Windows Server 2022 machines from a previous Microsoft Sentinel project, reducing overhead.</em></blockquote><h3>Installing Sysmon on the Windows Machine</h3><p>The first component I deployed was Sysmon, part of Microsoft’s Sysinternals Suite. Sysmon is a powerful tool that logs system activity to the Windows Event Log. It is widely used for endpoint visibility in many real-world SOC environments.</p><p>After downloading Sysmon, I installed it with a basic configuration using SwiftOnSecurity’s community config file:</p><pre>.\sysmon.exe -accepteula -i sysmonconfig-export.xml</pre><p>This allowed me to capture detailed logs about process creations, file modifications, network connections, and more.</p><p>Press enter or click to view image in full size</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*OGX-35N-A8i5DO2R.png" /></figure><p>Sysmon installed and running on Windows Server</p><h3>Setting Up the ELK Stack</h3><p>On the Ubuntu machine, I installed:</p><ul><li><strong>Elasticsearch</strong> for storing logs</li><li><strong>Logstash</strong> for ingesting and parsing logs</li><li><strong>Kibana</strong> for dashboard visualization</li></ul><p>I added Elastic’s GPG key and repository, updated the package lists, and installed all three components. Each service was started and enabled to run on boot.</p><p>Example setup command for Elasticsearch:</p><pre>sudo apt install elasticsearch<br>sudo systemctl enable elasticsearch</pre><p>Logstash was configured with a pipeline that accepts logs from Winlogbeat on port 5044 and forwards them to Elasticsearch. I edited the winlogbeat.yml file.</p><p>Press enter or click to view image in full size</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*YF_qV5SWG5NfmQrs.png" /></figure><p>Kibana Setup</p><p>Kibana was then configured and started. Visiting http://&lt;ubuntu-ip&gt;:5601 brought me to the Kibana UI</p><h3>Step 3: Configuring Winlogbeat on Windows</h3><p>With the ELK Stack live and reachable, I downloaded and configured Winlogbeat on the Windows Server machine. Winlogbeat is a lightweight shipper for forwarding and centralizing Windows Event Logs, including Sysmon logs.</p><p>I edited the winlogbeat.yml file with the appropriate Logstash output and enabled the security module:</p><pre>output.logstash:<br>  hosts: [&quot;&lt;ubuntu-ip&gt;:5044&quot;]</pre><pre>winlogbeat.event_logs:<br>  - name: Security<br>    event_id: 4624, 4625<br>  - name: Microsoft-Windows-Sysmon/Operational</pre><p>I then ran the following command to set up the pipeline and dashboards:</p><pre>.\winlogbeat.exe setup -e</pre><p>This command ensured that necessary index templates and default dashboards were loaded into Elasticsearch and Kibana.</p><p>Press enter or click to view image in full size</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*AUDA31uQTJO-zgTc.png" /></figure><p>Winlogbeat setup output confirming successful integration</p><h3>Verifying the Data Flow</h3><p>Once everything was in place, I visited Kibana via browser and navigated to <strong>Discover</strong>. Here, I confirmed that logs were being ingested in real time.</p><p>The Discover tab initially displayed @timestamp and event.category. I added fields like process.name, event.action, and message to gain context about each event.</p><p>Press enter or click to view image in full size</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*qJkF6sNlC5JAPLij.png" /></figure><p>Press enter or click to view image in full size</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*YfuFfoCQqdA-R0sF.png" /></figure><p>Press enter or click to view image in full size</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ob5HLhaGYZ4ef0qa.png" /></figure><p>Log visibility in Kibana Discover</p><h3>Simulating Suspicious Activities</h3><p>Once I confirmed that Sysmon was logging events and Winlogbeat was successfully shipping them into Kibana, I began simulating potentially malicious behaviors.</p><p><strong>Initially, I considered running a brute-force RDP attack</strong>. But to be frank, that tactic is so overused in detection engineering demos that I felt it lacked originality. Instead, I decided to focus on post-exploitation activities — tactics often missed when defenders only look for perimeter-based attacks.</p><p>Here are the three techniques I simulated:</p><ol><li><strong>Suspicious PowerShell Execution</strong></li></ol><pre>powershell -EncodedCommand aQBlAGMAZQBoACAidGVzdCI=</pre><p>This command is a base64-encoded string that simply echoes “test”. However, encoded PowerShell commands are a red flag in security monitoring, as attackers often use this technique to obfuscate malicious payloads.</p><blockquote><strong><em>MITRE ATT&amp;CK Mapping:</em></strong></blockquote><ul><li><strong>T1059.001 — Command and Scripting Interpreter: PowerShell</strong></li><li><strong>T1027 — Obfuscated Files or Information</strong></li></ul><p>Press enter or click to view image in full size</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*PzyGQMwM7azYRjoy.png" /></figure><p>Encoded PowerShell command logged in Kibana</p><p><strong>2. Creation of a New Admin User via CMD</strong></p><pre>net user eviladmin P@ssw0rd! /add<br>net localgroup administrators eviladmin /add</pre><p>This is a classic example of privilege escalation. I executed these commands to simulate an attacker silently adding a new admin user.</p><blockquote><strong><em>MITRE ATT&amp;CK Mapping:</em></strong></blockquote><ul><li><strong>T1136.001 — Create Account: Local Account</strong></li><li><strong>T1078 — Valid Accounts</strong></li></ul><p>I filtered logs by searching for event.code: 4720 OR 4732 in Kibana, which represent user creation and group modification respectively.</p><p>Press enter or click to view image in full size</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*uSTs3qN5fEFOawnG.png" /></figure><p>New user and privilege escalation events</p><p>This is a classic example of privilege escalation. I executed these commands to simulate an attacker silently adding a new admin user.</p><p><strong>3. Persistence via Registry Key for Notepad</strong></p><pre>New-ItemProperty -Path &quot;HKCU:\Software\Microsoft\Windows\CurrentVersion\Run&quot; -Name &quot;OneDriveUpdate&quot; -Value &quot;C:\Windows\System32\notepad.exe&quot;</pre><p>This command ensures that Notepad opens every time the system boots. Though harmless in this case, this technique is a commonly used persistence tactic in real-world malware. The registry key modification triggered a Sysmon event which was logged and ingested by ELK.</p><blockquote><strong><em>MITRE ATT&amp;CK Mapping:</em></strong></blockquote><ul><li><strong>T1547.001 — Boot or Logon Autostart Execution: Registry Run Keys</strong></li><li><strong>T1053 — Scheduled Task/Job (if any scheduling mechanism was used additionally)</strong></li></ul><p>Press enter or click to view image in full size</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*_sr3nFJmdDLe8q01.png" /></figure><p>Press enter or click to view image in full size</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*PTBKyQS03Dvk60Mx.png" /></figure><p>Registry persistence technique detected</p><p>These simulations helped validate that my log pipeline was functioning as intended and laid the groundwork for alerting or dashboarding, even if advanced features like detection rules weren’t enabled in this setup.</p><h3>Why This Matters</h3><p>In a real-world SOC or Blue Team environment, understanding the behavior of endpoints and spotting anomalies is crucial. This project simulates that workflow:</p><ul><li>Collecting granular telemetry (via Sysmon)</li><li>Forwarding logs efficiently (via Winlogbeat)</li><li>Parsing and enriching data (via Logstash)</li><li>Centralizing storage (via Elasticsearch)</li><li>Visualizing and analyzing threats (via Kibana)</li></ul><p>Each tool plays a part in forming a lightweight, scalable detection pipeline</p><h3>Potential Next Steps</h3><p>Although I didn’t configure alerting due to license restrictions on my self-managed ELK setup, this could be a logical extension for the future. Alerts could be integrated with:</p><ul><li>Email</li><li>Slack</li><li>Webhooks</li><li>Orchestration tools (e.g. TheHive or ElastAlert)</li></ul><h3>Final Thoughts</h3><p>This project was an opportunity to replicate the essence of a SIEM pipeline on a minimal budget, using fully open-source tooling. While tools like Microsoft Sentinel offer greater scalability and automation, this hands-on approach helps build foundational understanding.</p><p>Reusing my previous lab environment saved time and gave me a sense of continuity in building a layered, observable security environment.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=79c0797fcc3a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AI-Powered SOC Alerts: Enriching Splunk Detections with n8n, Gemini, and Slack]]></title>
            <link>https://medium.com/@somuma1074/ai-powered-soc-alerts-enriching-splunk-detections-with-n8n-gemini-and-slack-bab08e2b61de?source=rss-9735c756fa33------2</link>
            <guid isPermaLink="false">https://medium.com/p/bab08e2b61de</guid>
            <dc:creator><![CDATA[Somuma]]></dc:creator>
            <pubDate>Mon, 04 May 2026 01:33:14 GMT</pubDate>
            <atom:updated>2026-05-04T01:33:14.677Z</atom:updated>
            <content:encoded><![CDATA[<p>Part 2 of a 2-part series on building an AI-enhanced SOC alerting workflow</p><p><strong>Where We Left Off</strong></p><p>Part 1 ended with a Splunk alert configured, tested, and ready to fire. The detection query was solid, the webhook action was in place, and the only thing missing was something on the other end to receive it. Part 2 is that other end.</p><p>By the time this post is done, the workflow will take every Splunk alert, pass it through an automation pipeline, hand it to Google Gemini for AI enrichment, and deliver a formatted analyst-ready message to Slack, with severity classification, MITRE ATT&amp;CK mapping, possible causes, recommended response steps, and prevention guidance. All of it automated, none of it requiring a human to touch a keyboard between detection and delivery.</p><p>Press enter or click to view image in full size</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*67EyY3pNjjhbKPzY.png" /></figure><p><strong>Deploying n8n on DigitalOcean</strong></p><p><strong>n8n</strong> is an open-source workflow automation tool that acts as the orchestration layer between Splunk and everything else. In enterprise SOC environments this role belongs to dedicated <strong>SOAR platforms</strong>. n8n gives you the same fundamental capability, receive an alert, apply logic, call external services, deliver output, without the enterprise price tag, and it’s self-hosted, which matters when security event data is flowing through it.</p><p>I deployed n8n on a separate <strong>DigitalOcean droplet</strong> from the Splunk server. The specs were modest: <strong>Ubuntu 22.04</strong>, <strong>2 vCPUs</strong>, <strong>4GB RAM</strong>. Keeping n8n on its own VM rather than co-locating it with Splunk keeps the roles clean and mirrors how these components would be separated in a real environment.</p><p>n8n was deployed using <strong>Docker Compose</strong>. Start by installing Docker on the droplet:</p><pre>sudo apt update<br>sudo apt install -y docker.io docker-compose<br>sudo systemctl enable --now docker</pre><p>Create a working directory and the Compose file:</p><pre>mkdir ~/n8n &amp;&amp; cd ~/n8n<br>nano docker-compose.yml</pre><p>The initial configuration:</p><pre>services:<br>  n8n:<br>    image: n8nio/n8n:latest<br>    ports:<br>      - &quot;5678:5678&quot;<br>    environment:<br>      - N8N_HOST=134.209.29.86<br>      - N8N_PORT=5678<br>      - N8N_PROTOCOL=http<br>      - N8N_BASIC_AUTH_ACTIVE=true<br>      - N8N_BASIC_AUTH_USER=admin<br>      - N8N_BASIC_AUTH_PASSWORD=&lt;your-password&gt;<br>      - N8N_ENCRYPTION_KEY=&lt;long-random-string&gt;<br>      - N8N_DIAGNOSTICS_ENABLED=false<br>    volumes:<br>      - n8n_data:/home/node/.n8n<br>    restart: unless-stopped</pre><pre>volumes:<br>  n8n_data:</pre><p>The <strong>N8N_ENCRYPTION_KEY</strong> is used to encrypt stored credentials inside n8n’s database. Set it once and treat it like a secret if you change it after n8n has already stored credentials, it will fail to decrypt them on the next restart and refuse to boot. That exact scenario came up during this project. The fix was to bring the container down with docker-compose down -v to wipe the volume entirely and start fresh. Worth knowing before it happens to you.</p><p>Start the container:</p><pre>docker-compose up -d<br>docker-compose ps</pre><p>Verify its running:</p><pre>curl -I http://127.0.0.1:5678/</pre><p>A <strong>200 OK</strong> response means n8n is up. The web UI is accessible at <a href="http://your-droplet-ip:**5678**">http://your-droplet-ip:**5678**</a> — open that in a browser and you should see the n8n login screen.</p><p>Press enter or click to view image in full size</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*C2J5MBTwr0Bz_d5B.png" /></figure><p>docker-compose ps output showing n8n container status as Up</p><p>Press enter or click to view image in full size</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Sj83dREC38XqqCry.png" /></figure><p>n8n login page loading in browser via the droplet IP</p><p><strong>Building the Workflow</strong></p><p>With n8n running, the next step is creating the workflow that processes Splunk alerts. Create a new workflow and build the following nodes in sequence.</p><p>Press enter or click to view image in full size</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*4EY610sdbfUMAwpD.png" /></figure><p><strong>Node 1 — Webhook</strong></p><p>The <strong>Webhook node</strong> is the entry point for the entire workflow. Every time Splunk fires an alert, it sends a <strong>POST request</strong> to this node. Configure it with <strong>HTTP Method</strong> set to POST, <strong>Path</strong> set to splunk/failed-logon, <strong>Respond</strong> set to Immediately, and <strong>Response Body</strong> set to {“status”:”received”}.</p><p>The immediate response matters. Splunk’s webhook action expects a quick acknowledgment and will treat the delivery as failed if it doesn’t get one. Once the workflow is saved and activated, the <strong>production URL</strong> becomes <a href="http://134.209.29.86:5678/webhook/splunk/failed-logon">http://134.209.29.86:5678/webhook/splunk/failed-logon</a>. This is the URL that goes into Splunk’s webhook alert action from Part 1.</p><p>To test the webhook before the full workflow is wired up, use the <strong>test URL</strong> in n8n and send a manual POST from PowerShell:</p><pre>Invoke-RestMethod -Method Post `<br>  -Uri &quot;http://134.209.29.86:5678/webhook-test/splunk/failed-logon&quot; `<br>  -ContentType &quot;application/json&quot; `<br>  -Body &#39;{&quot;test&quot;:&quot;hello&quot;}&#39;</pre><p>Press enter or click to view image in full size</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*_vPL2fM1gVu5785V.png" /></figure><p>Webhook node configuration showing method, path, and response settings</p><p><strong>Node 2 — Edit Fields (Set Node)</strong></p><p>The payload arriving from Splunk is <strong>nested</strong>. The result fields sit inside <strong>body.result</strong>, and every value comes through as a <strong>string</strong> including the failure count. This node flattens everything into clean <strong>top-level fields</strong> that the rest of the workflow can reference simply.</p><p>The fields to create and their source paths are: <strong>alert_name</strong> from $json.body.search_name, <strong>host</strong> from $json.body.result.host, <strong>user</strong> from $json.body.result.target_user, <strong>src_ip</strong> from $json.body.result.src_ip, <strong>failed</strong> from Number($json.body.result.failed), <strong>last_seen</strong> from $json.body.result.last_index_time, and <strong>is_local</strong> derived as a boolean by checking whether $json.body.result.src_ip equals 127.0.0.1.</p><p>Two of these deserve explanation. The <strong>failed</strong> field is cast to a number explicitly because the IF node downstream needs to compare it numerically, and Splunk sends it as a string. The <strong>is_local</strong> boolean is derived here rather than left to Gemini to infer — if the source IP is <strong>127.0.0.1</strong> the event is a <strong>local interactive logon</strong>, not a remote network attack, and that distinction needs to be established as a fact before it reaches the AI layer. Without it, Gemini will describe a lock-screen failed logon as a remote brute force, which is wrong.</p><p>Press enter or click to view image in full size</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*bu_D0B4qXwrxeNDG.png" /></figure><p><strong>Node 3 — IF Node</strong></p><p>This node is the <strong>threshold gate</strong>. It ensures the workflow only proceeds when the failure count is meaningful, adding a second layer of protection against low-signal events getting enriched and delivered unnecessarily. The condition is simply that <strong>failed</strong> is greater than or equal to <strong>5</strong>. The <strong>true branch</strong> continues to Gemini. The <strong>false branch</strong> does nothing, the workflow stops there.</p><p>Press enter or click to view image in full size</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*bXYBFBKxpxM1OAy_.png" /></figure><p>IF node showing the condition configuration</p><p><strong>Node 4 — Message a Model (Gemini)</strong></p><p>This is the node that gives the alert its intelligence. n8n has a native <strong>Gemini integration</strong> — search for it in the node list and connect it using a <strong>Google Gemini API credential</strong>. The API key comes from <strong>Google AI Studio</strong>, which has a free tier that covers this use case comfortably. The model used was <strong>gemini-2.5-flash</strong>.</p><p>In the node settings, two toggles matter: disable <strong>Simplify Output</strong> and enable <strong>Output Content as JSON</strong>. Simplify Output can silently restructure the model’s response in ways that break downstream field references. Output Content as JSON tells n8n to treat Gemini’s response as structured data rather than plain text.</p><p>The prompt passed to Gemini:</p><pre>You are a SOC analyst generating a security alert for Slack.</pre><pre>Detection:<br>Multiple consecutive failed Windows logon attempts (Event ID 4625) with no <br>successful login (4624) breaking the streak.</pre><pre>Important interpretation rules:<br>- If src_ip is 127.0.0.1 OR is_local = true, treat this as a LOCAL / <br>  INTERACTIVE logon attempt (console / lock screen), NOT remote RDP.<br>- Do NOT describe this as a network-based brute-force if it is local.<br>- Be accurate, concise, and practical.</pre><pre>Observed event facts (authoritative):<br>- Host: {{ $json.host }}<br>- User: {{ $json.user }}<br>- Source IP: {{ $json.src_ip }}<br>- Failed attempts: {{ $json.failed }}<br>- Last seen: {{ $json.last_seen }}<br>- Local logon: {{ $json.is_local }}</pre><pre>Severity guidance:<br>- Critical: failed attempts &gt;= 10<br>- High: failed attempts 5–9<br>- Medium: failed attempts &lt; 5</pre><pre>Produce a rich but concise alert with:<br>1) Title including severity<br>2) One-sentence summary<br>3) Key details<br>4) Correct MITRE ATT&amp;CK technique and ID<br>5) Possible causes (2–3 bullets)<br>6) Recommended response steps (3–5 bullets)<br>7) Prevention and hardening steps (3–5 bullets)</pre><pre>Return ONLY valid JSON in this structure:</pre><pre>{<br>  &quot;title&quot;: &quot;&quot;,<br>  &quot;severity&quot;: &quot;&quot;,<br>  &quot;summary&quot;: &quot;&quot;,<br>  &quot;mitre&quot;: &quot;&quot;,<br>  &quot;possible_causes&quot;: [],<br>  &quot;response_steps&quot;: [],<br>  &quot;prevention&quot;: [],<br>  &quot;slack_text&quot;: &quot;&quot;<br>}</pre><pre>Full raw event payload for reference:<br>{{ JSON.stringify($json, null, 2) }}</pre><p>Press enter or click to view image in full size</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*9cGziu9ov4WZUuhr.png" /></figure><p>Gemini node showing model selection and the prompt</p><p>Press enter or click to view image in full size</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*lsNCKX-i0M0XfN3H.png" /></figure><p>Gemini node output panel showing the structured JSON response from the model</p><p><strong>Node 5 — Code Node</strong></p><p>Gemini’s response arrives wrapped in the standard <strong>API response structure</strong> — a <strong>candidates array</strong> with nested content and parts. The actual JSON we care about is buried inside <strong>candidates[0].content.parts[0].text</strong> as a string. This node extracts and parses it into a proper <strong>JavaScript object</strong> so subsequent nodes can reference fields directly.</p><pre>const txt = $json.candidates?.[0]?.content?.parts?.[0]?.text;</pre><pre>if (!txt) throw new Error(&quot;No Gemini text found&quot;);</pre><pre>const parsed = JSON.parse(txt.trim());</pre><pre>return [{ json: parsed }];</pre><p>After this node, all of Gemini’s output fields — <strong>title</strong>, <strong>severity</strong>, <strong>summary</strong>, <strong>mitre</strong>, <strong>possible_causes</strong>, <strong>response_steps</strong>, <strong>prevention</strong>, <strong>slack_text</strong> — are accessible as clean top-level keys.</p><p><strong>The Slack OAuth Problem — And How It Got Solved</strong></p><p>At this point the workflow was built and tested up to the Code node. The next step was adding the Slack node and connecting it — which is where things got complicated.</p><p>n8n’s Slack integration uses <strong>OAuth2</strong>. The OAuth flow requires Slack to redirect back to n8n after authorization, and that <strong>redirect URL needs to be HTTPS</strong>. n8n was running over plain <strong>HTTP</strong> on a raw IP address. Slack refused to accept it.</p><p>The standard solution would be to buy a domain and set up a reverse proxy with a TLS certificate. Instead, I used <strong>Cloudflare Tunnel</strong>, which achieves the same result without either of those things. Cloudflare Tunnel creates an outbound connection from the server to Cloudflare’s edge, and Cloudflare exposes it publicly over <strong>HTTPS</strong> with a valid certificate automatically.</p><p>Install cloudflared on the n8n droplet:</p><pre>wget -q https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.deb<br>sudo dpkg -i cloudflared-linux-amd64.deb</pre><p>Start a quick tunnel pointing at n8n’s local port:</p><pre>cloudflared tunnel --url http://localhost:5678</pre><p>Cloudflare assigns a <strong>public HTTPS URL</strong> within a few seconds, something like <a href="https://rocket-mixing-charlotte-practitioners.trycloudflare.com/">https://rocket-mixing-charlotte-practitioners.trycloudflare.com</a>.</p><p>Press enter or click to view image in full size</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*zvQfZCd1UDc5vVJK.png" /></figure><p>Cloudflare tunnel terminal output showing the assigned HTTPS URL</p><p>This URL is <strong>temporary</strong> — it lives as long as the terminal session stays open — but that is enough for completing the <strong>OAuth flow</strong> and storing the token in n8n.</p><p>With the tunnel running, update docker-compose.yml to tell n8n its public address has changed. The environment variables to update are <strong>N8N_HOST</strong>, <strong>N8N_PROTOCOL</strong>, <strong>WEBHOOK_URL</strong>, <strong>N8N_EDITOR_BASE_URL</strong>, and add <strong>N8N_TRUST_PROXY</strong> set to true. Restart n8n after saving the changes.</p><p>Now when you create a Slack credential in n8n, the <strong>OAuth redirect URL</strong> automatically becomes the Cloudflare HTTPS address followed by <strong>/rest/oauth2-credential/callback</strong>. That is the URL to add under <strong>Redirect URLs</strong> in the Slack app’s <strong>OAuth and Permissions</strong> settings.</p><p><strong>One More Blocker: Basic Auth</strong></p><p>Even with HTTPS sorted, the OAuth flow still failed. The credential would not connect and channels would not load. The error was <strong>Unauthorized</strong>.</p><p>The cause was n8n’s <strong>Basic Auth</strong> setting. Slack’s OAuth callback cannot pass Basic Auth credentials, so when it hit the n8n callback endpoint it was blocked. The fix was straightforward: temporarily disable Basic Auth in docker-compose.yml by setting <strong>N8N_BASIC_AUTH_ACTIVE</strong> to false, restart n8n, complete the OAuth connection, then re-enable Basic Auth and restart one more time. Once the Slack token is stored in n8n’s <strong>encrypted database</strong>, Basic Auth being active has no effect on Slack’s ability to send messages through the workflow.</p><p>Press enter or click to view image in full size</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Ubt3TvY-R-7nnf1C.png" /></figure><p>Press enter or click to view image in full size</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-BmY6vdZTBVdwh4a.png" /></figure><p>n8n Slack credential showing Connected status with workspace name visible</p><p><strong>Node 6 — Slack</strong></p><p>With the credential connected, add the <strong>Slack node</strong> at the end of the workflow. Select your channel and set the <strong>message field</strong> to {{$json.slack_text}}. The <strong>slack_text</strong> field was generated by Gemini as part of its structured JSON output. It contains a fully formatted <strong>Slack markdown message</strong> with all the relevant details already assembled — no additional formatting required.</p><p>Press enter or click to view image in full size</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*49EYdoLZxVzypo-S.png" /></figure><p>Slack node configuration showing channel selection and message field</p><p><strong>Testing End to End</strong></p><p>Save the workflow and set it to <strong>Active</strong> using the toggle in the top right of the n8n editor. An <strong>inactive workflow</strong> returns a <strong>404</strong> to incoming webhook calls, so this step is easy to miss.</p><p>Go back to the <strong>Windows VM</strong>, lock the screen, and enter the wrong password at least five times. Wait up to a minute for the <strong>Splunk alert</strong> to fire on its schedule. In n8n, open the <strong>Executions panel</strong> and watch for a new entry.</p><p>Press enter or click to view image in full size</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*iNk7j92rJt-WEFod.png" /></figure><p>n8n Executions panel showing a completed run with all nodes successful</p><p>If the execution completes without errors, check Slack.</p><p>Press enter or click to view image in full size</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*D-XA-6_LSWe55qu1.png" /></figure><p>Press enter or click to view image in full size</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*JjdlMCVgZVazq0S1.png" /></figure><p>Final Slack alert showing the AI-enriched message with title, severity, summary, MITRE mapping, possible causes, response steps, and prevention guidance</p><p>The alert that arrives is not a raw event dump. It has a clear <strong>title with severity</strong>, a <strong>plain-language summary</strong> of what happened, the key technical details, a <strong>MITRE ATT&amp;CK reference</strong>, and concrete guidance on what to do next. All of it generated automatically from a structured JSON payload.</p><p><strong>Closing Thoughts</strong></p><p>The division of responsibility in this pipeline is worth being clear about, because AI in security tooling is an area where overclaiming is common.</p><p><strong>Splunk handles detection.</strong> The pattern recognition, threshold logic, and alert firing all happen there. Nothing in this workflow relies on AI to identify suspicious behavior — that would be fragile and difficult to audit.</p><p><strong>n8n handles orchestration.</strong> It receives the payload, normalizes the data, applies the <strong>threshold gate</strong>, and manages the handoff between components.</p><p><strong>Gemini handles contextualization.</strong> Given a clean, accurate, structured input, it produces <strong>analyst-quality narrative</strong> consistently and quickly. It is not making decisions. It is explaining a decision that Splunk already made, in language that a human analyst can act on immediately.</p><p><strong>Slack is the delivery layer.</strong> The alert lands where analysts are already working, in a format that requires no additional pivot to understand.</p><p>What this project demonstrates in practice is that <strong>AI-assisted SOC tooling</strong> does not need to be complex or expensive to be genuinely useful. The intelligence in this workflow is not in any single component, it is in how the components are connected, and in the care taken to ensure that every stage passes <strong>clean, accurate data</strong> to the next one.</p><p><em>Part 1 covered the detection foundation — Splunk setup, log forwarding, the XML parsing issue, timestamp drift handling, and building a reliable threshold-based detection rule. Read that first if you haven’t already.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bab08e2b61de" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Full n8n workflow showing all nodes from Webhook to SlackDetection without context has no validity…]]></title>
            <link>https://medium.com/@somuma1074/full-n8n-workflow-showing-all-nodes-from-webhook-to-slackdetection-without-context-has-no-validity-5b5bdb8e3794?source=rss-9735c756fa33------2</link>
            <guid isPermaLink="false">https://medium.com/p/5b5bdb8e3794</guid>
            <dc:creator><![CDATA[Somuma]]></dc:creator>
            <pubDate>Mon, 04 May 2026 01:29:28 GMT</pubDate>
            <atom:updated>2026-05-04T01:29:28.482Z</atom:updated>
            <content:encoded><![CDATA[<h3>Full n8n workflow showing all nodes from Webhook to SlackDetection without context has no validity: Building AI enhanced Splunk Alert</h3><p><strong>The Problem with Most Failed Logon Alerts</strong></p><p>Failed authentication attempts are one of the most common early indicators of malicious activity in any Windows environment. Password guessing, brute-force attempts, credential stuffing, account misuse, they all leave the same fingerprint: repeated Event ID 4625 entries in the Windows Security log.</p><p>The problem is not that these events go undetected. Most SIEMs pick them up fine. The problem is what happens after detection. In most setups, the alert that fires looks something like this: a raw event dump with a timestamp, a username, and maybe a source IP. No severity classification. No context about whether this is local or remote activity. No guidance on what to do next. Just noise dressed up as signal. And in a busy SOC, an alert that doesn’t immediately tell an analyst what to do next doesn’t get investigated — it gets dismissed.</p><p>If an alert cannot help an analyst decide what to do next, it isn’t a detection, it’s a log with a title.</p><p>I wanted to build something better. Not just a detection, but the foundation for an alert that could actually help an analyst make a decision at 2am without needing to pivot through five different tools to understand what they were looking at.</p><p>This is Part 1 of a two-part series. Here, I focus entirely on the detection side: setting up the environment, getting logs flowing, and building a Splunk detection rule that produces clean, reliable, high-confidence alerts. Along the way I ran into real problems, a silent permissions failure that blocked Security log collection, a timestamp drift issue that made alerts fire inconsistently, and an XML parsing gotcha that made standard Splunk queries return nothing even when the data was right there. All of it is documented here. Part 2 covers everything that happens after the alert fires, the n8n automation pipeline, Google Gemini AI enrichment, and the final Slack delivery.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*gTQTmc5urjGgbvTR.png" /></figure><p><strong>Project Architecture</strong></p><p>Before getting into setup, it helps to understand what the full pipeline looks like and where Part 1 fits within it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*OEPYhwfn5q0e9yB3.png" /></figure><p>The complete workflow runs like this: a Windows 11 VM generates real failed logon events. Those events are forwarded to a self-hosted Splunk Enterprise instance running on an Ubuntu cloud VM. Splunk detects suspicious patterns and fires an alert via webhook to n8n, a workflow automation tool hosted on a separate DigitalOcean droplet. n8n processes and enriches the alert using Google Gemini, then delivers a formatted analyst-ready message to Slack.</p><p>Part 1 covers everything up to and including the Splunk webhook alert. Part 2 picks up from n8n onwards.</p><p>The stack for this project:</p><ul><li>Windows 11 VM (local) — generates authentication events</li><li>Splunk Enterprise — hosted on Ubuntu 22.04, cloud VM</li><li>Splunk Universal Forwarder — installed on the Windows VM</li><li>n8n — hosted on DigitalOcean via Docker Compose <em>(Part 2)</em></li><li>Google Gemini API — AI enrichment layer <em>(Part 2)</em></li><li>Slack — final alert delivery <em>(Part 2)</em></li><li>Cloudflare Tunnel — secure HTTPS exposure for n8n <em>(Part 2)</em></li></ul><p><strong>Setting Up the Splunk Server</strong></p><p>The first thing to get right is the SIEM itself. I deployed <strong>Splunk Enterprise</strong> on a cloud <strong>Ubuntu 22.04</strong> VM. For a lab environment, the minimum specs that kept things stable were <strong>2 vCPUs</strong> and <strong>4GB of RAM, </strong>Splunk is heavier than it looks, and running it on anything less will cause you pain during searches.</p><p>Before installing anything, I opened the following ports on the VM: port <strong>22</strong> for SSH access, port <strong>8000</strong> for the Splunk Web UI, and port <strong>9997</strong> for the forwarder receiving port, which is how the Windows VM sends logs in. Port <strong>9997</strong> is easy to forget and will cost you an hour of debugging if you do.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*UUYERetRxzZCXE-_.png" /></figure><p>With the VM up and ports open, I downloaded and installed Splunk:</p><blockquote><em>wget -O splunk.deb “https://download.splunk.com/products/splunk/releases/10.2.0/linux/splunk-9.2.0-linux-2.6-amd64.deb&quot;<br>sudo dpkg -i splunk.deb<br>sudo /opt/splunk/bin/splunk start — accept-license</em></blockquote><p>During first startup, Splunk prompts you to create an <strong>admin username and password</strong>. Set something you’ll actually remember — you’ll be logging into the web UI frequently.</p><p>After that, enable <strong>boot-start</strong> so Splunk survives VM reboots:</p><pre>sudo /opt/splunk/bin/splunk enable boot-start</pre><p>Once it’s running, Splunk Web is accessible at <a href="http://your-server-ip:8000/">http://your-server-ip:8000</a>.</p><p>Press enter or click to view image in full size</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*kjRgT3-It7fUACwA.png" /></figure><p>Splunk Web UI</p><p><strong>Configuring Splunk to Receive Forwarded Logs</strong></p><p>Splunk needs to be explicitly told to listen for incoming log data from forwarders. By default it does not. Navigate to <strong>Settings → Forwarding and Receiving → Configure Receiving → Add New</strong>, add port <strong>9997</strong> and save.</p><p><strong>Setting Up the Windows VM and Installing the Universal Forwarder</strong></p><p>The <strong>Windows 11 VM</strong> hosted locally on <strong>VMware</strong> is the log source, this is the machine that will generate the failed logon events we want to detect. For the <strong>Splunk Universal Forwarder</strong> to collect Windows Security logs and ship them to Splunk, it needs to run as <strong>Local System</strong>, which has the permissions required to read the Security event channel.</p><p>Download the Universal Forwarder from Splunk’s website and run the installer. During setup, the important fields are the <strong>Receiving Indexer</strong>, which should be set to your <strong>Splunk server’s public IP</strong>, and the <strong>port</strong>, which should be <strong>9997</strong>.</p><p>After installation, the forwarder needs to know which logs to collect. Navigate to <strong><em>C:\Program Files\SplunkUniversalForwarder\etc\system\local\</em></strong> and create or edit<strong><em> inputs.conf</em></strong> with the following:</p><pre>[WinEventLog://Security]<br>disabled = 0<br>index = wineventlog<br>renderXml = true</pre><pre>[WinEventLog://System]<br>disabled = 0<br>index = wineventlog</pre><pre>[WinEventLog://Application]<br>disabled = 0<br>index = wineventlog</pre><p>Restart the forwarder service to apply the config</p><p>Press enter or click to view image in full size</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*6BsUeQGyh0FfqAa6.png" /></figure><p>inputs.conf file open in Notepad on the Windows VM</p><p><strong>Validating Log Ingestion</strong></p><p>Before building any detection, confirm that Security logs are actually arriving. One thing that I caught early: searching for <strong><em>EventCode=4625 </em></strong>returned nothing, even though the events were clearly present. The reason is that because <strong>renderXml = true</strong> was set in inputs.conf, the Security logs are indexed under the sourcetype <strong>XmlWinEventLog:Security</strong>, and the <strong>EventID</strong> is stored inside the XML body rather than as a flat extracted field. Searching for it as a field doesn’t work. The correct approach is to match the <strong>XML tag</strong> directly:</p><pre>index=wineventlog sourcetype=&quot;XmlWinEventLog:Security&quot; &quot;&lt;EventID&gt;4625&lt;/EventID&gt;&quot;</pre><p>This returns results immediately. It’s a small but important distinction, and one that will silently break your detection if you don’t account for it.</p><p>Press enter or click to view image in full size</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*BLb7pIe_4XMaK8Rn.png" /></figure><p>Splunk search using the XML tag approach returning 4625 events</p><p><strong>Generating the Failed Logon Events</strong></p><p>Rather than scripting synthetic events or relying on a separate attacker machine, the simulation here was straightforward and deliberately realistic: lock the Windows VM and repeatedly enter the wrong password.</p><p>Press <strong>Win+L </strong>to lock the screen, then enter incorrect credentials several times in a row. This generates real Windows authentication failures, with real <strong>Event ID 4625</strong> entries, real <strong>logon type</strong> values, and real timestamps. The source IP for local lock-screen attempts shows as <strong>127.0.0.1</strong>, and the <strong>logon type is 2 (Interactive)</strong>, which distinguishes this cleanly from remote network-based attacks.</p><p>After generating several failures, confirm they appear in Splunk:</p><pre>index=wineventlog sourcetype=&quot;XmlWinEventLog:Security&quot; &quot;&lt;EventID&gt;4625&lt;/EventID&gt;&quot;</pre><p>Click into one of the raw events and check that the XML fields are present ,specifically <strong>TargetUserName,</strong> <strong>IpAddress</strong>, and <strong>LogonType</strong>. These are the fields the detection query depends on.</p><p>Press enter or click to view image in full size</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*FtNHd0mKPieLtu6k.png" /></figure><p>Raw Event ID 4625 in Splunk showing XML fields</p><p><strong>Building the Detection Rule</strong></p><p>This is where the project moves from log collection to actual <strong>detection engineering</strong>. The goal was not simply to count failures. A user mistyping their password twice and then logging in successfully is not an incident. What matters is <strong>consecutive failure</strong>s with no successful login breaking the streak.</p><p>There was also a <strong>timestamp problem</strong> to solve. Windows event time reflects when the event occurred on the endpoint. In lab environments with any kind of ingestion delay, anchoring a time-window query to <strong>_time</strong> (the event timestamp) caused alerts to fire inconsistently. The fix was to use <strong>_indextime</strong> instead, this reflects when Splunk actually indexed the event, which is reliable regardless of what the Windows clock says.</p><p>The final detection query</p><pre>index=wineventlog sourcetype=&quot;XmlWinEventLog:Security&quot; &quot;&lt;EventID&gt;4625&lt;/EventID&gt;&quot;<br>| where _indextime &gt;= relative_time(now(), &quot;-10m&quot;)<br>| rex field=_raw &quot;Name=&#39;TargetUserName&#39;&gt;(?&lt;target_user&gt;[^&lt;]+)&quot;<br>| rex field=_raw &quot;Name=&#39;IpAddress&#39;&gt;(?&lt;src_ip&gt;[^&lt;]+)&quot;<br>| stats count as failed latest(_indextime) as last_index_time by host target_user src_ip<br>| where failed &gt;= 5<br>| eval last_index_time=strftime(last_index_time,&quot;%Y-%m-%d %H:%M:%S&quot;)</pre><p>Breaking this down: the <strong>_indextime filter</strong> ensures the query only looks at events that arrived in the last 10 minutes rather than events that happened 10 minutes ago by the Windows clock. The <strong>rex commands</strong> extract TargetUserName and IpAddress directly from the raw XML. The <strong>stats block</strong> counts failures per unique combination of host, user, and source IP. The <strong>threshold</strong> is set at 5 or more failures. And <strong>last_index_time</strong> is formatted into a readable timestamp for the alert payload.</p><p>Run this query after generating your failed logons. You should see a result row with your host, username, source IP of <strong>127.0.0.1</strong>, and a failure count.</p><p>Press enter or click to view image in full size</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*5MMS1C7kDorwZMwn.png" /></figure><p>Detection query results showing host, target_user, src_ip, and failed count</p><p><strong>Converting the Query into a Splunk Alert</strong></p><p>With the detection confirmed, the next step is turning it into a <strong>scheduled alert</strong> that fires automatically. In Splunk, with the query in the search bar, go to <strong>Save As → Alert</strong>.</p><p>The settings that matter: <strong>Alert type</strong> should be Scheduled, the schedule should run every <strong>1 minute</strong> using the cron expression */1 * * * *, the <strong>time range</strong> should be Last 10 minutes to match the _indextime filter in the query, the <strong>trigger condition</strong> should be Number of Results is greater than 0, <strong>Trigger</strong> should be set to Once, and <strong>Throttle</strong> should be enabled at 5 minutes with <strong>src_ip</strong> as the suppression field.</p><p>The throttle setting is important. Without it, the alert will fire every minute for as long as the failures persist. Setting it to <strong>5 minutes</strong> with <strong>src_ip</strong> as the suppression key means Splunk will only alert once per source IP within that window, which is the correct SOC behaviour.</p><p>Press enter or click to view image in full size</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*tULCAbKcfxSno4T8.png" /></figure><p>Splunk alert configuration page showing schedule, trigger, and throttle settings</p><p>For the alert action, add a <strong>Webhook</strong> and point it at your n8n instance. The webhook URL format will be covered in Part 2 once n8n is deployed, but configuring the action now means the alert is ready to fire the moment the automation layer is live. The JSON payload Splunk sends looks like this:</p><pre>{<br>  &quot;result&quot;: {<br>    &quot;host&quot;: &quot;splunk&quot;,<br>    &quot;target_user&quot;: &quot;David&quot;,<br>    &quot;src_ip&quot;: &quot;127.0.0.1&quot;,<br>    &quot;failed&quot;: &quot;6&quot;,<br>    &quot;last_index_time&quot;: &quot;2026-02-07 22:46:21&quot;<br>  },<br>  &quot;search_name&quot;: &quot;Failed logon&quot;,<br>  &quot;owner&quot;: &quot;admin&quot;<br>}</pre><p><strong>Where Part 1 Ends</strong></p><p>At this point the detection pipeline is fully operational. Windows Security logs are flowing into Splunk, the <strong>XML parsing issue</strong> is resolved, the detection logic accounts for <strong>consecutive failures</strong> rather than raw counts, <strong>timestamp drift</strong> is handled correctly, and the alert is configured to fire and deliver a structured payload.</p><p>Everything built here was done deliberately with Part 2 in mind. The <strong>src_ip</strong> field is preserved because the automation layer uses it to determine whether an alert represents local or remote activity. The structured payload is minimal and clean because <strong>Gemini</strong> works better with focused input than with noise. The throttle is set because the Slack channel shouldn’t be flooded.</p><p>Part 2 picks up from here: deploying n8n, building the enrichment workflow, integrating Gemini, and delivering an alert to Slack that reads like it was written by a Tier 2 analyst rather than generated by a script.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5b5bdb8e3794" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[WIN ALL DAY!]]></title>
            <link>https://medium.com/@somuma1074/win-all-day-73b572a31713?source=rss-9735c756fa33------2</link>
            <guid isPermaLink="false">https://medium.com/p/73b572a31713</guid>
            <dc:creator><![CDATA[Somuma]]></dc:creator>
            <pubDate>Thu, 30 Apr 2026 08:45:11 GMT</pubDate>
            <atom:updated>2026-04-30T08:45:11.464Z</atom:updated>
            <content:encoded><![CDATA[<p>WIN ALL DAY!</p><p>DISCLAIMER! #THE ARTICLE IS A MEDITATION IN THE PRACTICE OF KEYBOARD SPEED TYPING INIT</p><p>WHAT IS WINNING<br>Winning can be measured qualitatively and quantitatively. The democrat president of the United States, Trump, in his 2023 campaign against republicans who supported Biden, said that, “We will win again and again until we get tired of winning”. The beauty in the statement is similar to a bouquet of tulips. In fact, winning doesn’t feel like an option anymore; it’s a necessity for Trump’s administration regarding a global race for world order. We all know the “shitty top tier manifesto” in use to achieve outcomes of a war economy. The underdogs are facing it rough, aren’t they?. Now, back to winning, are you strategic about it? Winning comes with risks, and that makes the person and process vulnerable.</p><p>A new win version 1.2.1 has been released. Put your boots on and get ready to explore the new release. The official sponsor of this version is the Premier League club Manchester United. With the right manager, you can do it — Winning practically. Manchester’s change in management for the head coach position has turned a struggling team into the best in the world. That is what the noisy fans are loudly incorporating into the football fan zone community. Consecutive wins against the current English football giants Manchester City and Arsenal in a row show how the stakes are high. Manchester United fans must be living in a Disneyland dream at the moment. Is this version even real? A win is a win in football, but a trophy is much better; it’s a quality win. This isn’t legal advice.</p><p>Are you embracing winning in your technical, administrative, or policy journey? The evolution of digital space feels like an accelerated adrenaline rush, so fast that you cannot consume it all at once. I hope that you keep engaging in meaningful interactions, learning, and getting strategic in planning and execution. Invest wisely!!</p><p>The primary purpose of the roadmap to winning is time-consuming. Are you ready to start an enterprise today? Purpose is having a vision, mission, core values, and the self-drive to fuel the process. Every aspect of winning is achieved by infusing untapped self-drive. Building professionalism in the art boosts sustainability to/in excellence.</p><p>KEEP WINNING!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=73b572a31713" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>