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 Lumos Package #9276

Merged
merged 2 commits into from
Mar 15, 2024
Merged

Add Lumos Package #9276

merged 2 commits into from
Mar 15, 2024

Conversation

ethanzh
Copy link
Contributor

@ethanzh ethanzh commented Mar 5, 2024

Proposed commit message

This PR introduces a package for Lumos (lumos.com). The Lumos product itself has an Activity Log, and we would like customers to be able to ship their Activity Logs directly to their Elastic instance.

In order to support this, we added an /activity_logs endpoint to our API, which returns data in this form:

{
    "items":
        [{
            "actor": {
                "actor_type": "Lumos"
            },
            "event_began_at": "2023-12-29T19:26:16",
            "event_hash": "b1205b5116d3d798035a359dea4313382d6409ff02350e4600bce2e161c1c2bbe91a05de8c3ed7c3b1efce9751d9548523dc2fbca67191ca1a060976581c5215",
            "event_metadata": {},
            "event_type": "SEND_REQUEST_APPROVAL_FOR_ACCESS_REQUEST_SLACK",
            "event_type_user_friendly": "Lumos attempted to send a Slack notification to this approver requesting approval for an access request",
            "outcome": "Succeeded",
            "targets": [
                {
                    "access_length": "Unlimited",
                    "app": {
                        "app_id": "salesforce.com",
                        "instance_id": "00D5f000005vnLlEAI",
                        "user_friendly_label": "Salesforce - Dev"
                    },
                    "business_justification": "read only test with new permission for flows on staging",
                    "permissions": [
                        {
                            "label": "Read Only [Profile]",
                            "source": "MANUAL",
                            "type": "PERMISSION",
                            "value": "Read Only [Profile]"
                        }
                    ],
                    "requester_user": {
                        "email": "cypress@lumostester.com",
                        "family_name": "Tests",
                        "given_name": "Cypress"
                    },
                    "target_type": "Access Request",
                    "target_user": {
                        "email": "bellatrix.lestrange@lumostester.com",
                        "family_name": "Lestrange",
                        "given_name": "Bellatrix"
                    }
                },
                {
                    "email": "albus@lumostester.com",
                    "family_name": "Dumbledore",
                    "given_name": "Albus",
                    "target_type": "User"
                }
            ]
        }
    ],
    "limit": 50,
    "links": {
        "first": "/activity_logs?since=2023-12-06T15%3A39%3A42Z&offset=0",
        "last": "/activity_logs?since=2023-12-06T15%3A39%3A42Z&offset=400",
        "next": "/activity_logs?since=2023-12-06T15%3A39%3A42Z&offset=50",
        "prev": null,
        "self": "/activity_logs?since=2023-12-06T15%3A39%3A42Z"
    },
    "offset": 0,
    "total": 446
}

Essentially, we support filtering responses by ISO8601-encoded strings until and since. And we also return a next link in the response in order to simplify the pagination logic on the Elastic side.

Because this is a 0.1.0, we do not do anything fancy with the log once we receive it, we simply log it in the json column. A next step will be to extract out common fields from the JSON response (e.g. actor.email).

Our API is authenticated through a bearer token that the user provides.

Checklist

  • I have reviewed tips for building integrations and this pull request is aligned with them.
  • I have verified that all data streams collect metrics or logs.
  • I have added an entry to my package's changelog.yml file.
  • I have verified that Kibana version constraints are current according to guidelines.

Author's Checklist

  • [ ]

How to test this PR locally

Related issues

Screenshots

Screenshot 2024-03-06 at 10 38 40 AM
Screenshot 2024-03-06 at 10 49 52 AM
Screenshot 2024-03-06 at 10 49 39 AM

@ethanzh ethanzh changed the title Run elastic-package create commands Add Lumos Package Mar 6, 2024
@ethanzh ethanzh marked this pull request as ready for review March 6, 2024 16:43
@ethanzh ethanzh requested a review from a team as a code owner March 6, 2024 16:43
@ethanzh
Copy link
Contributor Author

ethanzh commented Mar 6, 2024

/test

@ethanzh
Copy link
Contributor Author

ethanzh commented Mar 6, 2024

Pinging @elastic/security-service-integrations (Team:Security-Service Integrations)

@ethanzh
Copy link
Contributor Author

ethanzh commented Mar 11, 2024

Hi @jamiehynds -- thanks for adding the tags. Please let me know if there is any other information I can provide here to make it easier on you all's end :)

@ethanzh
Copy link
Contributor Author

ethanzh commented Mar 11, 2024

Really appreciate the review @efd6 I'll address comments and turn this around as quickly as I can

@ethanzh ethanzh force-pushed the ethanzh/lumos-integration branch 2 times, most recently from 37eb893 to b15f694 Compare March 11, 2024 22:41
packages/lumos/_dev/build/docs/README.md Outdated Show resolved Hide resolved
packages/lumos/_dev/build/docs/README.md Outdated Show resolved Hide resolved
packages/lumos/manifest.yml Outdated Show resolved Hide resolved
@ethanzh ethanzh force-pushed the ethanzh/lumos-integration branch 5 times, most recently from fb93614 to 29c7a96 Compare March 13, 2024 20:03
@ethanzh ethanzh requested a review from efd6 March 13, 2024 20:05
@ethanzh
Copy link
Contributor Author

ethanzh commented Mar 13, 2024

Hey @efd6, thank you again for the previous review.

I've incorporated all of your feedback and re-pushed the branch. The biggest change here is the addition of a proper system test, similar to the 1Password implementation you linked me to.

Please let me know what else, if anything, needs to be improved here. Thank you!

@efd6
Copy link
Contributor

efd6 commented Mar 13, 2024

/test

Copy link
Contributor

@efd6 efd6 left a comment

Choose a reason for hiding this comment

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

Can you include some pipeline test cases so that we can build on the logic for event classification as it is added?

@ethanzh ethanzh force-pushed the ethanzh/lumos-integration branch 2 times, most recently from 62f023a to c043414 Compare March 14, 2024 04:51
@ethanzh
Copy link
Contributor Author

ethanzh commented Mar 14, 2024

/test

@ethanzh ethanzh force-pushed the ethanzh/lumos-integration branch 2 times, most recently from 03e071b to 12c9c05 Compare March 14, 2024 05:09
@ethanzh
Copy link
Contributor Author

ethanzh commented Mar 14, 2024

@efd6 Thank you again, you've been super helpful. Since your last review I've done the following:

  • Add processor logic in integest_pipeline/default.yml to set event.outcome
  • Add processor in default.yml to set event.kind=event.
  • Add processor in default.yml to set event.type=info. In a future iteration I will refine event.type to be more granular, as well as correctly setting event.category by creating a mapping from event.action -> event.category
  • Fixed-up the whitespaces. Apologies for that, can't seem to get my editor to respect the 2 space by default
  • Rename json to lumos_activity to remove the need to manually rename many columns
  • README.md formatting
  • Newline in pipeline test file

@ethanzh ethanzh requested a review from efd6 March 14, 2024 17:57
@efd6
Copy link
Contributor

efd6 commented Mar 14, 2024

/test

@ethanzh
Copy link
Contributor Author

ethanzh commented Mar 14, 2024

Shoot, I'll double-check that the README files are in-sync. Looks like that's what's failing CI

@ethanzh
Copy link
Contributor Author

ethanzh commented Mar 14, 2024

Just re-ran the build, apologies for that oversight

@efd6
Copy link
Contributor

efd6 commented Mar 14, 2024

/test

@elasticmachine
Copy link

🚀 Benchmarks report

To see the full report comment with /test benchmark fullreport

Copy link
Contributor

@efd6 efd6 left a comment

Choose a reason for hiding this comment

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

Last nit, then LGTM

@ethanzh
Copy link
Contributor Author

ethanzh commented Mar 14, 2024

Made that one final tweak

@efd6
Copy link
Contributor

efd6 commented Mar 14, 2024

/test

@ethanzh ethanzh requested a review from efd6 March 14, 2024 23:39
processors:
{{processors}}
{{/if}}

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change

😄 Too many.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hah, third time is the charm!

@ethanzh ethanzh requested a review from efd6 March 15, 2024 00:27
@efd6
Copy link
Contributor

efd6 commented Mar 15, 2024

/test

@elasticmachine
Copy link

💚 Build Succeeded

History

Copy link

@efd6 efd6 merged commit 7b8302f into elastic:main Mar 15, 2024
5 checks passed
@efd6
Copy link
Contributor

efd6 commented Mar 15, 2024

Thanks

@ethanzh
Copy link
Contributor Author

ethanzh commented Mar 15, 2024

Hey @efd6 one more question. I'm seeing this build failure on the main branch -- is this a result of something I did incorrectly?

Screenshot 2024-03-15 at 7 02 27 AM

@efd6
Copy link
Contributor

efd6 commented Mar 17, 2024

No, there is nothing wrong in what was done here. I will look into what is going on.

@elasticmachine
Copy link

Package lumos - 0.1.0 containing this change is available at https://epr.elastic.co/search?package=lumos

@ethanzh
Copy link
Contributor Author

ethanzh commented Mar 18, 2024

Hi @efd6, I've noticed that https://epr.elastic.co/search?package=lumos is still blank. Let me know if there's something I can do on my end to help debug/remediate. Thank you

@ethanzh
Copy link
Contributor Author

ethanzh commented Mar 18, 2024

Additionally, should we expect Lumos to be showing up in this catalog: https://www.elastic.co/integrations/data-integrations?

@efd6
Copy link
Contributor

efd6 commented Mar 18, 2024

The package is not GA, so it won't show up without the experimental flag, https://epr.elastic.co/search?package=lumos&experimental=true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants