Skip to content

[opencanary] Update Event ECS Fields to Remove Noise #13162

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

Merged
merged 3 commits into from
Mar 20, 2025

Conversation

mohitjha-elastic
Copy link
Collaborator

Proposed Commit Message

Update Event ECS Fields to Remove Unwanted Alert Noise.
Log ID 1000-1006 is related to base message hence event.* fields should not be set in that case. Also, as requested in the issue, message ECS field is already present in the pipeline.

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.

How to test this PR locally

Clone integrations repo.
Install the elastic package locally.
Start the elastic stack using the elastic package.
Move to integrations/packages/opencanary directory.
Run the following command to run tests.
elastic-package test -v

Related issues

@mohitjha-elastic mohitjha-elastic requested a review from a team as a code owner March 19, 2025 07:24
@mohitjha-elastic mohitjha-elastic added bugfix Pull request that fixes a bug issue Crest Contributions from Crest developement team. Team:Security-Service Integrations Security Service Integrations team [elastic/security-service-integrations] Integration:opencanary OpenCanary (Community supported) Team:Sit-Crest Crest developers on the Security Integrations team [elastic/sit-crest-contractors] labels Mar 19, 2025
@elasticmachine
Copy link

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

@mohitjha-elastic mohitjha-elastic self-assigned this Mar 19, 2025
@elastic-vault-github-plugin-prod

🚀 Benchmarks report

To see the full report comment with /test benchmark fullreport

@@ -1,4 +1,9 @@
# newer versions go on top
- version: "0.4.1"
changes:
- description: Update event ecs fields to remove unwanted alert noise.
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
- description: Update event ecs fields to remove unwanted alert noise.
- description: Update event ECS fields to remove unwanted alert noise.

value:
- network
- intrusion_detection
if: ctx.opencanary?.logtype != null && ![1000, 1001, 1002, 1003, 1004, 1005, 1006].contains(ctx.opencanary.logtype)
Copy link
Contributor

Choose a reason for hiding this comment

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

Since opencanary.logtype is a long, can we

Suggested change
if: ctx.opencanary?.logtype != null && ![1000, 1001, 1002, 1003, 1004, 1005, 1006].contains(ctx.opencanary.logtype)
if: ctx.opencanary?.logtype != null && (ctx.opencanary.logtype < 1000 || 1006 < ctx.opencanary.logtype)

instead? This saves an allocation, and reduces the number of comparisons. Similar below.

Updated condition to set event.kind to reduce complexity and save allocation.
@mohitjha-elastic mohitjha-elastic requested a review from efd6 March 19, 2025 10:29
@elasticmachine
Copy link

💚 Build Succeeded

History

cc @mohitjha-elastic

Copy link

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.

Thanks

@efd6
Copy link
Contributor

efd6 commented Mar 20, 2025

Before you merge, can you clarify what "Also, as requested in the issue, message ECS field is already present in the pipeline." means in this context? It doesn't look like anything involving message is being done here.

@efd6
Copy link
Contributor

efd6 commented Mar 20, 2025

Ah, OK. The test shows that that is already set. We don't need to mention that in the commit, and the "Anything else?" section in the issue is not a "Would you like fries with that?", it's a "Is there anything else we should know?"

@efd6 efd6 merged commit 1627cac into elastic:main Mar 20, 2025
7 checks passed
@elastic-vault-github-plugin-prod

Package opencanary - 0.4.1 containing this change is available at https://epr.elastic.co/package/opencanary/0.4.1/

@andrewkroh andrewkroh removed the Crest Contributions from Crest developement team. label Mar 20, 2025
flexitrev pushed a commit that referenced this pull request Mar 25, 2025
Log ID 1000-1006 is related to base message hence event.* fields should not be
set in that case.
flexitrev pushed a commit that referenced this pull request Mar 28, 2025
Log ID 1000-1006 is related to base message hence event.* fields should not be
set in that case.
flexitrev pushed a commit that referenced this pull request Mar 28, 2025
Log ID 1000-1006 is related to base message hence event.* fields should not be
set in that case.
flexitrev pushed a commit that referenced this pull request Mar 28, 2025
Log ID 1000-1006 is related to base message hence event.* fields should not be
set in that case.
@mohitjha-elastic mohitjha-elastic deleted the opencanary-0.4.1 branch May 15, 2025 07:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix Pull request that fixes a bug issue Integration:opencanary OpenCanary (Community supported) Team:Security-Service Integrations Security Service Integrations team [elastic/security-service-integrations] Team:Sit-Crest Crest developers on the Security Integrations team [elastic/sit-crest-contractors]
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[opencanary]: Sets all log message event.kind == alert leading to unwanted alert noise in Elastic Security
4 participants