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

util/misc: add time parser #12367

Closed
wants to merge 1 commit into from
Closed

Conversation

inashivb
Copy link
Member

@inashivb inashivb commented Jan 9, 2025

  1. The idea is to have a time unit parser that can be used by keywords that let you define time as precisely as microseconds or as loosely as hours.
  2. In the future work, this would apply to flow.rate keyword, for example, where one can define bytes (kb, b, mb, gb) and time (us, ms, s, m, h) as they wish. Exact same application would come for use in defining elephant flows in suricata.yaml (an exhibit for that is in Mark flow elephant/v4 #12325)

Thoughts?
If this is acceptable, I thought we could merge it first.

Add a parser for different units of time. Acceptable values for defining
time are:
us: microseconds
ms: milliseconds
s:  seconds
m:  minutes
h:  hours

This is in order to have a more fine grained control over time which may
be required for certain keywords and operations.
@inashivb inashivb requested a review from victorjulien as a code owner January 9, 2025 10:55
Copy link

codecov bot commented Jan 9, 2025

Codecov Report

Attention: Patch coverage is 87.64706% with 21 lines in your changes missing coverage. Please review.

Project coverage is 82.50%. Comparing base (494d7bf) to head (f6a9cc4).

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #12367      +/-   ##
==========================================
- Coverage   82.54%   82.50%   -0.04%     
==========================================
  Files         912      912              
  Lines      258028   258198     +170     
==========================================
+ Hits       212988   213027      +39     
- Misses      45040    45171     +131     
Flag Coverage Δ
fuzzcorpus 60.54% <12.82%> (-0.18%) ⬇️
livemode 19.39% <17.94%> (-0.01%) ⬇️
pcap 44.42% <17.94%> (-0.01%) ⬇️
suricata-verify 63.16% <17.94%> (-0.03%) ⬇️
unittests 58.13% <85.29%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

@suricata-qa
Copy link

Information: QA ran without warnings.

Pipeline 24134

@inashivb
Copy link
Member Author

Victor won't accept it w/o a user so, it'll come with the linked PR itself.

@inashivb inashivb closed this Jan 10, 2025
@inashivb inashivb deleted the time-parser/v1 branch January 10, 2025 09:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants