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

Userguide: clarify lua's need key usage differences (Doc#4725) - v1 #6480

Closed
wants to merge 4 commits into from

Conversation

jufajardini
Copy link
Contributor

Link to redmine ticket:
https://redmine.openinfosecfoundation.org/issues/4725

Describe changes:

  • add explanation about the difference in usage when writing output or detection script
  • add some more examples showing how to initialize need in case of detection script
  • rename Lua Scripting page, in Rules section, to Lua Scripting for Detection, for better semantics
  • update said page with other existing buffers for detection
  • nit: fix typo in Lua output page

The differences on how the `need` key works, depending on script
usage (output or detection) confuses users, sometimes (cf doc#4725).
While we don't fix that, just explain this behavior.
Since we can have scripts for output _or_ detection, it seems more
clear to rename this page to add more meaning
@codecov
Copy link

codecov bot commented Oct 15, 2021

Codecov Report

Merging #6480 (cee1be9) into master (07370ed) will increase coverage by 0.02%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master    #6480      +/-   ##
==========================================
+ Coverage   77.05%   77.08%   +0.02%     
==========================================
  Files         613      613              
  Lines      186733   186734       +1     
==========================================
+ Hits       143890   143938      +48     
+ Misses      42843    42796      -47     
Flag Coverage Δ
fuzzcorpus 52.85% <ø> (ø)
suricata-verify 52.13% <ø> (+0.04%) ⬆️
unittests 63.12% <ø> (ø)

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


function init (args)
local needs = {}
needs["packet"] = tostring(true)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: do false and "false" mean the same thing in Lua?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you do:

print(type("false"))
print(type(false))

First will print string, second will print boolean

But print(type(tostring(false))) and print(type(tostring("false"))) both are strings...
Not sure if this answers your question 😅

@suricata-qa
Copy link

WARNING:

field test baseline %
tlpr1_stats_chk
.flow.mgr.rows_maxlen 364 539 67.53%

Pipeline 4661

@jufajardini
Copy link
Contributor Author

WARNING:
field test baseline %
tlpr1_stats_chk
.flow.mgr.rows_maxlen 364 539 67.53%

Pipeline 4661

🤔

@ct0br0
Copy link

ct0br0 commented Oct 29, 2021

thinking

I wouldn't worry about it. A lot of the small stats (especially these ones that came about after the flow fix a couple weeks ago) are nothing major.

@jufajardini
Copy link
Contributor Author

thinking

I wouldn't worry about it. A lot of the small stats (especially these ones that came about after the flow fix a couple weeks ago) are nothing major.

Thanks, was especially curious because this supposedly only changed documentation pages...

@victorjulien victorjulien mentioned this pull request Nov 24, 2021
@victorjulien
Copy link
Member

Merged in #6642, thanks!

@jufajardini jufajardini deleted the doc/4725-lua-needs/v1 branch December 8, 2021 19:01
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.

5 participants