Skip to main content

SuricataLog

Downloads

When I started learning how to use Suricata quickly found that I needed a tool to inspect the eve.json file; Most of the tutorials and documentation out there suggested installing a stack to do the following tasks:

  1. Store the logs in a central location
  2. Normalize and enrich the events, specially alerts
  3. Use a frontend to dive into the data

Which is very useful, but what if I just needed to do a quick inspection of the events?

Sooner or later you will get bored to death doing this:

cat eve.json | jq -r -c 'select(.event_type=="alert")|.payload'| base64 --decode

SuricataLog is a set of tools/ scripts to parse and display Suricata log files (like /var/log/suricata/eve.json)

The Eve JSON format is not very complex, so I wrote few scripts with the features I tough would be more useful for my home network analysis.

As a bonus, I wrote my learning experience as a tutorial that you can use to learn about Suricata and also how to test it.

Installing from PIP

Before you do anything else, make sure your environment is good to go:

python3 -m venv ~/virtualenv/suricatalog
. ~/virtualenv/suricatalog/bin/activate
python3 -m pip install --upgrade pip setuptools wheel

Installing from Pypi.org

pip3 install --upgrade SuricataLog

Installing from source

git clone git@github.com:josevnz/SuricataLog.git
cd SuricataLog
python3 -m venv ~/virtualenv/suricatalog
. ~/virtualenv/suricatalog/bin/activate
python3 -m pip install --upgrade build
python3 -m build
pip3 install dist/SuricataLog-X.Y.Z-py3-none-any.whl

Developer installation

So you want to contribute? Or found a bug and think you can submit a patch? Nice! Here is what you can dd to run on development mode:

git clone git@github.com:josevnz/SuricataLog.git
cd SuricataLog
python3 -m venv ~/virtualenv/suricatalog
. ~/virtualenv/suricatalog/bin/activate
pip install --upgrade pip
python -m pip install --upgrade build
pip install textual-dev
pip install --editable .

Running unit tests is very easy after that:

(SuricataLog) [josevnz@dmaf5 SuricataLog]$ python -m unittest test/*.py
.........
----------------------------------------------------------------------
Ran 9 tests in 0.334s

OK

If the unit tests fails, then this is most likely the first place to fix a problem.

I do recommend also running the textualize console and watch for the console messages:

textual console

Then on another terminal:

textual run --dev --command eve_log --timestamp '2015-01-01 10:41:21.642899' --formats TABLE test/eve.json

Running the scripts

Once everything is installed you should be able to call the scripts

Simple EVE log parser

Better see it by yourself (remember, use --help to learn what options are supported)

Table format:

suricatalog-eve_log-table.png

eve_log --timestamp '2015-01-01 10:41:21.642899' --formats TABLE test/eve.json

Canned reports with eve_json.py

(suricatalog) [josevnz@dmaf5 SuricataLog]$ eve_json --help
usage: eve_json [-h] [--nxdomain | --payload | --flow | --netflow NETFLOW | --useragent] eve [eve ...]

This script is inspired by the examples provided on [15.1.3. Eve JSON ‘jq’ Examples](https://suricata.readthedocs.io/en/suricata-6.0.0/output/eve/eve-json-
examplesjq.html) A few things: * The output uses colorized JSON

positional arguments:
  eve                Path to one or more /var/log/suricata/eve.json file to parse.

optional arguments:
  -h, --help         show this help message and exit
  --nxdomain         Show DNS records with NXDOMAIN
  --payload          Show alerts with a printable payload
  --flow             Aggregated flow report per protocol and destination port
  --netflow NETFLOW  Get the netflow for a given IP address
  --useragent        Top user agent in HTTP traffic

Take a look at some examples below:

NXDOMAIN

suricatalog-eve_json-nxdomain.png

eve_json --nxdomain test/eve.json

PAYLOAD

suricatalog-eve_json-payload.png

eve_json --payload ~/Downloads/eve.json

FLOW

suricatalog_eve_json-flow.png

eve_json --flow test/eve_udp_flow.json

NETFLOW

suricatalog_eve_json-netflow.png

eve_json --netflow 224.0.0.251 test/eve_udp_flow.json

USERAGENT

suricatalog-eve_json-useragent.png

eve_json --useragent test/eve.json

Running eve_* applications on a browser

Suricata eve server, running eve* applications on a browser!

You can run Suricata Log applications on a browser by using the eve_server wrapper:

# Show the flow report on a eve.json file
eve_server --application eve_json -- --flow ~/eve.json

# Show NX domain report
eve_server --application eve_json -- --nxdomain ~/eve.json

# Inspect the eve.json records
eve_server --applications eve_log -- ~/eve.json

You need to pass the '--' to tell the server than this options belong to the underlying eve_* you want to call.

Supported versions

I work on this project on my spare time and I cannot support every version of Linux/ Python combination out there. This is my current test bed, and it may change without further notice

SuricataLog Supported OS Python Suricata
<= 0.8 NO NA < 3.8 6.04
0.9+ NO fedora 37 => 3.11.4 6.04
0.9+ NO Armbian 23.02.2 Jammy => 3.10.6 6.04
0.9+ NO Ubuntu 20.04.4 LTS (Focal Fossa) => 3.8.10 6.04
1.0.3+ YES fedora 40 => 3.11.4 7.0.6

You are more than welcome to:

  • Submit patches with new features and bug-fixes.
  • Open bug reports. Be as detailed as possible, otherwise I will have no choice but to close it.

Tutorials

Metadata

Release files for SuricataLog 1.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for SuricataLog 1.0.3
File Size Uploaded
suricatalog-1.0.3.tar.gz 24.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for SuricataLog 1.0.3
File Interpreter ABI Platform
SuricataLog-1.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 51.7 kB

Release files / suricatalog-1.0.3.tar.gz

Download URL suricatalog-1.0.3.tar.gz
Size 24.6 kB
Tags Source
SHA-256 checksum
How to use checksums
4bfc344a3ac2de9af43f69312bf1bfec9ca9123762b66c70f4a181a76d8b6e1c
BLAKE2b-256 checksum
How to use checksums
a9ad39e0defb8f83ffc52fa99d121083aacf0c6f09f9db8baae01d201837c4a0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.11.6

Release files / SuricataLog-1.0.3-py3-none-any.whl

Download URL SuricataLog-1.0.3-py3-none-any.whl
Size 27.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a1842dc2176790957dd1c389839015e07b585890a14ffece45451b6afd45ade2
BLAKE2b-256 checksum
How to use checksums
cb198db6e34856077baf1b8230a7dbfa9bca1bf41e2ef5195b55f158c57f374e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.11.6

Release history Release notifications | RSS feed

1.2.0

2 release files

1.1.6

2 release files

1.1.5

2 release files

1.1.4

2 release files

1.1.3

1 release file

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.9

2 release files

1.0.8

2 release files

1.0.7

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.4

2 release files

This release

1.0.3 This release

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.1

1 release file

0.1.0

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page