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 Organization to fields sent to Splunk and Elastic #3399

Merged
merged 3 commits into from
Apr 10, 2024

Conversation

KALRONG
Copy link
Contributor

@KALRONG KALRONG commented Apr 8, 2024

Add org_name field containing the Organization Name for use on Splunk

"Add org_name field containing the Organization Name for use on Splunk
@CLAassistant
Copy link

CLAassistant commented Apr 8, 2024

CLA assistant check
All committers have signed the CLA.

@@ -113,7 +113,11 @@ sources:
timestamp(epoch=now()) AS timestamp,
ClientId, Flow.session_id AS FlowId,
"artifact_" + regex_replace(source=_value,
re='[/.]', replace='_') as _index
re='[/.]', replace='_') as _index,
{
Copy link
Contributor

Choose a reason for hiding this comment

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

This is extremely unperformant as it would have to scan all the clients for every insertion.

I would suggest instead to use org().name which contains the current org's name. Maybe even use LET to store it in a variable before the query (the org name is not going to change right?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The idea of using it in every interaction was due to the possibility of several organizations being present on the same hunt. If this is not an use case previously I was using org().name too

Copy link
Contributor

Choose a reason for hiding this comment

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

It is not possible to have multiple orgs in the same hunt since each org has a separate hunt manager.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Then Im confused as for why when I create a new hunt I can select which organizations to use, maybe I missunterstood something.

Copy link
Contributor

Choose a reason for hiding this comment

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

Orgs are documented here https://docs.velociraptor.app/docs/deployment/orgs/

They are completely separate with a different set of hunts, clients, custom artifacts etc.

As an org admin you can launch a hunt on multiple orgs in the GUI but each of those hunts are independent.

Also each server monitoring artifact is independent inside each org. So you can choose to only upload some orgs to splunk and just others. Within each artifact instance the org() plugin will be constant by definition.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

All right, wasn't aware of that segregation even when lunching on multiple orgs, will then make the changes as you suggested. Should we close this PR and open a new one or just update this one?

Copy link
Contributor

Choose a reason for hiding this comment

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

Just update this one - thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done! Took the chance to also apply it to Elastic where I found it most usefull. And thanks to you for your patience and great work!

Update so the organization name is stored in a variable instead of being queried every single iteration.

Add same behaviour to Elastic.
@KALRONG KALRONG changed the title Add Organization to fields sent to Splunk Add Organization to fields sent to Splunk and Elastic Apr 9, 2024
@scudette scudette merged commit d533580 into Velocidex:master Apr 10, 2024
3 checks passed
scudette added a commit that referenced this pull request Apr 10, 2024
Add org_name field containing the Organization Name for use on Splunk

---------

Co-authored-by: Mike Cohen <mike@velocidex.com>
scudette added a commit that referenced this pull request Apr 11, 2024
Add org_name field containing the Organization Name for use on Splunk

---------

Co-authored-by: Mike Cohen <mike@velocidex.com>
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.

3 participants