Zeroska
  • 🐱Zeroska - The Bold
  • Computer/Cyber Security
    • ⭐Fresh off the boat - for new Blue Teamer/ SOC Analyst
    • 💀Necromancer (DFIR)
      • 🕵️DFIR and DFIR case
        • 🗃️Case Files
          • Misconfiguration 0x01
      • 📔My own DFIR notes
        • The Mark of The Web (MOTW)
        • LNK Shortcut
        • Prefetch, AmCache, ShimCache in Windows
        • Malicious Document (VBA, Office, PDF, ...)
        • SRUM (System Resource Usage Monitor)
        • Volatility notes
        • Understand Logon Session in Windows
        • "Very" Hidden sheets in Excel
        • Hidden Processes
      • 📔Notes
        • Useful Resources
        • Useful Resources DFIR
        • Saved Content (Backup for the OG content get deleted)
          • How to be best SOC analyst ever
    • 🧙‍♂️Defense Witchcraft
      • Data Analysis as a Defender
      • Active Directory
      • Windows Event Logs
        • Authentication (Windows Account Life Cycle Events)
      • MS Exchange
      • Windows
    • 💙My Current Blue Team Operation
      • VLAN Monitoring Template
      • Daily Monitoring Report
      • General Playbook
      • JupyterHub Configuration Guide
      • How to train your Blue Team
    • 🏭ICS/OT
      • Setup ICS/OT Simulation Learning Lab
      • Smart Grids
      • Learning Modbus TCP
      • Learning DNP3
      • Resources/Blogs/Links
    • 🥷Threat Intelligence
      • Small Cyber Threat Intelligence Program
      • Intelligence Analysis [VN]
      • OSINT Information Monitoring
        • Telegram Info-Stealer Monitoring
      • C2 Tracker
      • Fake Website Tracker
      • Dark Web Investigation Attempt
      • Threat Intelligence Quick Win
      • Resources/Blogs/Links
  • 😒Computer and Technology
    • My Home Lab Setup
    • 🐴ELK Stack
      • Useful Resources
      • ELK Stack - Container - Docker Compose - AWS ECS
      • ECS - Elastic Common Schema
      • Elasticsearch
      • Logstash
      • Troubleshooting and Problems
    • 🐧Linux
      • Setting up good SSH Authentication
      • Configure Auditd and how to leverage it
      • ELF Format
      • Useful Links
    • 📦Containers
      • Docker container logs is quite big
      • Worth Reading
    • 🪠Splunk Learning Experience
      • Splunk Test Lab
      • Data Collection Tier (How to get the data)
      • SC4S Custom Filter For Windows Event Log in Syslog Format (NXLog)
      • Useful Resources
  • Threat Hunting
    • Hunting for Implant
    • Using STRIDE and DREAD
    • 🐳Predators and Preys (Computing)
      • Tracks or Hunting Artifacts
    • 📦Network Packet Analysis
      • The Basic
      • Tshark | Zeek Copy & Paste
      • Network Analysis Resources
    • Grep | Powershell Search | Regex
    • Hunting Resources
  • 🎵In my remains
    • Choices
    • The Art of Facing Unknown Problems
    • Build the best DFIR team
    • Reverse Engineering - Đồ án hướng ngành A "Hụt" của tôi
Powered by GitBook
On this page
  • Tricks Worth Reading
  • Research about Grok (Parsing Logs like a God)
  • Write good grok patterns
  • How to write your own custom grok patterns
  • My thought on Logstash
  • Using Input, Filter, and Output
  • Input
  • Filter
  • Output
  • Compex Logstash Configuration
  • Logstash Plugins
  • Logstash Configuration tips and tricks

Was this helpful?

  1. Computer and Technology
  2. ELK Stack

Logstash

Poor man log parser

PreviousElasticsearchNextTroubleshooting and Problems

Last updated 1 year ago

Was this helpful?

Tricks Worth Reading

  • (one of the most detail slides about Logstash, I would recommend reading this for a better understanding)

  • (read the hold thing and maybe you won't need to read the rest of this blog)

  • (God damn, why am I not found this sooner)

Research about Grok (Parsing Logs like a God)

Check all these refs

Everybody going to tell you if you are facing unstructured data and you need to structure it in a way to process it then Grok is the way. I'm not going to talk about the syntax and other fundamental stuff

Grok is dead simple and you just need to know that, so what are the questions that most people going to ask

  • How to write good grok patterns

  • Multiline??

Write good grok patterns

Ground rule

  • Avoid writing grok pattern from specific to general since grok match in order, grok miss is very expensive -> Destroy your performance

  • Don't be afraid to use conditional (also don't be like me, I'm has a habit that doesn't plan the conditional statement ahead and later ending up with a complex logic that is very hard to maintain, I'm trying to fix that problem)

Grok Example

How to write your own custom grok patterns

My thought on Logstash

Logstash is a server-side data processing pipeline that ingests data from a multitude of sources simultaneously, transforms it, and then sends it to your favorite "stash.". Logstash has over 200 plugins, and you can write your own very easily as well.

Date: March 6, 2022

-----

I think it is a wonderful piece of software, it is simple at a high level and easy to use. I don't know about the performance (Using JVM) of a lot of plugins (Honestly I just use the default plugin but soon maybe I will try another or write one myself)

Date: Aug 13, 2023

-----

Writing plugins for logstash is much easier than writing SC4S custom parser.

Using Input, Filter, and Output

Logstash pipeline is fairly simple, it has 3 part which is input, filter, and output

Input

Logstash has various input sources (the documentation has all the supported sources). all the famous are up there. You could have multiple input source

So what happens when you declare an Input in logstash?

It creates a thread and

Filter

Output

Compex Logstash Configuration

Writing a Logstash pipeline to filter and normalize log is one of my favorites

Logstash Plugins

Logstash Configuration tips and tricks

_grokparsefailure is very costly to performance -> try not to fail at parsing or fail faster (Why this is a thing, you should read this )

Using only match those patterns against the whole string from start to finish, and nothing else. (^ and $)

https://www.elastic.co/elasticon/conf/2016/sf/dive-deep-with-logstash-from-pipelines-to-persistent-queues
https://www.elastic.co/blog/a-practical-introduction-to-logstash
https://github.com/hellosign/logstash-fundamentals/tree/master/examples
https://coralogix.com/blog/logstash-grok-tutorial-with-examples/
https://www.elastic.co/blog/do-you-grok-grok
Anchor
😒
🐴
Page cover image