-
Notifications
You must be signed in to change notification settings - Fork 1.7k
output-json/output-json-flow: Geoip enrichment [v2] #14567
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -53,7 +53,7 @@ | |
| #include "flow-storage.h" | ||
| #include "util-exception-policy.h" | ||
|
|
||
| static SCJsonBuilder *CreateEveHeaderFromFlow(const Flow *f) | ||
| static SCJsonBuilder *CreateEveHeaderFromFlow(const Flow *f, const OutputJsonCommonSettings *cfg) | ||
| { | ||
| char timebuf[64]; | ||
| char srcip[46] = {0}, dstip[46] = {0}; | ||
|
|
@@ -93,6 +93,13 @@ static SCJsonBuilder *CreateEveHeaderFromFlow(const Flow *f) | |
| /* time */ | ||
| SCJbSetString(jb, "timestamp", timebuf); | ||
|
|
||
| #ifdef HAVE_GEOIP | ||
| if (cfg != NULL && cfg->geoip_enabled) { | ||
| SCGeoIPGet(jb, srcip, "geoip_src"); | ||
| SCGeoIPGet(jb, dstip, "geoip_dst"); | ||
| } | ||
| #endif /* HAVE_GEOIP */ | ||
|
|
||
|
Comment on lines
+96
to
+102
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would say we shouldn't change what we have in the flow header. Either we add this info further down in the header, or add this to
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh I see, so place those under the
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm thinking so... Let's see if we get more feedback. Any thoughts, @jasonish ? |
||
| CreateEveFlowId(jb, (const Flow *)f); | ||
|
|
||
| #if 0 // TODO | ||
|
|
@@ -432,7 +439,7 @@ static int JsonFlowLogger(ThreadVars *tv, void *thread_data, Flow *f) | |
| /* reset */ | ||
| MemBufferReset(thread->buffer); | ||
|
|
||
| SCJsonBuilder *jb = CreateEveHeaderFromFlow(f); | ||
| SCJsonBuilder *jb = CreateEveHeaderFromFlow(f, &thread->ctx->cfg); | ||
| if (unlikely(jb == NULL)) { | ||
| SCReturnInt(TM_ECODE_OK); | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, the schema-check script will complain about this, due to non-alphabetical order (as the CI shows).
To check these locally, run:
./scripts/schema-sort.py --check ./etc/schema.json