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

Add event counter #312

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Conversation

CapacitorSet
Copy link
Contributor

Fixes #303, depends on #284.

Adds an event counter with a configurable period.

Example configuration:

[[filter]]
channel=["console"]
groupby=["category"]
period=5

This configuration groups events by the "category" key, so that eg. if one receives 10 HTTP requests in 3 seconds, the following event will be emitted:

transforms > group > original-category=http, group.count=10, token=[...], date=[...], category=group, sensor=transforms

Note that the event is fired 5 seconds after the first event, so a series of requests across 12 seconds will result in 3 separate events.

This feature opens interesting scenarios if used together with plugins (creating filters that could implement "count the number of root logins per hour", for example), which should probably be documented together with this feature. However, it's also somewhat pushing the limits of the "expressive power" granted by Honeytrap, which only allows for a data flow with a fixed order for transforms (eg. you can't use a filter after a plugin) and a fixed amount of transforms (there can only be one plugin, one group-by), an issue which might be worth looking into.

@codecov-io
Copy link

codecov-io commented Jul 10, 2018

Codecov Report

❗ No coverage uploaded for pull request base (master@674ac4f). Click here to learn what that means.
The diff coverage is 2.5%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master     #312   +/-   ##
=========================================
  Coverage          ?   43.57%           
=========================================
  Files             ?       70           
  Lines             ?     8336           
  Branches          ?        0           
=========================================
  Hits              ?     3632           
  Misses            ?     4288           
  Partials          ?      416
Impacted Files Coverage Δ
services/memcached.go 0% <ø> (ø)
services/dns-proxy.go 0% <ø> (ø)
services/counterstrike.go 0% <ø> (ø)
services/tftp.go 0% <ø> (ø)
server/honeytrap.go 3.05% <0%> (ø)
services/services.go 8.82% <6.25%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 674ac4f...a2090c6. Read the comment docs.

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

Successfully merging this pull request may close these issues.

channels: have repetitive event counters
2 participants