Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

corsarotrace not following specified number of output files when using multiple threads #120

Open
b10n opened this issue Jan 7, 2025 · 0 comments

Comments

@b10n
Copy link

b10n commented Jan 7, 2025

When generating flowtuples from pcaps, corsarotrace does not follow the interval and rotatefreq options.

Commit: 9e899da

Steps to reproduce (using Podman, Docker should be similar):

  1. Generate a pcap with one packet/hour.
from scapy.all import *
from datetime import datetime, timedelta

start_date = datetime.now()

packets = []

for i in range(24):
    packet_time = start_date + timedelta(hours=i)
    packet = Ether() / IP(src="192.168.1.1", dst="192.168.1.2") / UDP(sport=12345, dport=80) / Raw(load=f"Packet from day {i+1}")
    packet.time = packet_time.timestamp()
    packets.append(packet)

wrpcap("one_day.pcap", packets)
  1. Run corsarotrace multi-threaded.
mkdir output
podman run -v './output:/flowtuple/output:rw' -v './one_day.pcap:/flowtuple/example.pcap:ro' offlineft pcapfile:/flowtuple/example.pcap trial run
ls output/*.avro | wc -l

Result: 1
Expected: 24 files since baseconfig.yaml contains interval: 60 and rotatefreq: 60 (one file per hour).

  1. Force corsarotrace to run single-threaded.
echo "threads: 1" >> baseconfig.yaml
podman build -t offlineft .
podman run -v './output:/flowtuple/output:rw' -v './one_day.pcap:/flowtuple/example.pcap:ro' offlineft pcapfile:/flowtuple/example.pcap trial run
rm output/*
ls output/*.avro | wc -l

Result: 24 (expected)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant