-
Notifications
You must be signed in to change notification settings - Fork 29
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
Batch Size Affects Log Parsing #60
Comments
As it stands, the batch size has to be met before it is handed to the processor. If the batch size is set to 10 and you send it two logs, they will sit in the queue waiting for another 8 logs to show up. What is happening, you're sending 2 logs with a batch size of 10 and then control-c'ing (i assume) the program. Since the batch size isn't met, the logs are discarded. I've run into this myself. I'll have the batch size set to 50 and my rules won't work. I'll be cussing at the keyboard, then realize what is happening. I can look into forcing the logs to be processed when Sagan gets an interrupt. At least then it might be less confusing. |
Another note: The batch size should only be altered if you're environment is really busy (10k+ EPS). On your test system, always leave the batch size at 1 or you'll find yourself banging your head on the keyboard. In super busy environments, the batch size can make a big difference in CPU usage. |
Sagan is run like so and completes on it's own, but it sounds like your points are still applicable since only 2 logs are ever ingested:
Note, Sagan is run as root only because I'm bad at containers and I'm not sure it's a good idea to make different users within an a container (if it's even possible). Thank you for the clarification! Would it be possible to make note of this in the documentation? As it stands the verbiage makes it sound like you should run anything other than a batch-size of 1. |
I opened a ticket for documenting this. I also looked at the code to see if I can change the behavior. It doens't look very straight forward to me but I want to think about it for a day or two. Initially I thought I saw an easy fix but that creates a race condition and the logs still dont get processed. |
Sagan Version
Compiled with commit fa32f8f and the following config options:
wharding@ruletest:~/sagan$ ./configure --enable-geoip --enable-esmtp --enable-libpcap --enable-redis --enable-gzip
Expected Behavior
Attempting to utilize only JSON for log ingestion should result in JSON being parsed correctly with the following (abbreviated) settings:
Using the following rule should result in an alert for the included log:
Logs:
Observed Behavior
No alerts are generated from the log (duplicated the log in my local env):
Changing the
batch-size
to1
from10
results in two successful alerts.From the docs it is not clear why this would have an affect: batch-size
The text was updated successfully, but these errors were encountered: