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

websocket: new generic integration #9926

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

muskan-agarwal26
Copy link
Contributor

Proposed commit message

This makes the Filebeat Websocket input available as an integration package.

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

screencapture-127-0-0-1-5602-app-integrations-detail-websocket-0-1-0-overview-2024-05-21-15_39_24
Screenshot 2024-05-21 154613

1. This makes the Filebeat Websocket input available as an integration package.
@muskan-agarwal26 muskan-agarwal26 changed the title New Generic Integration websocket: New Generic Integration May 21, 2024
@muskan-agarwal26 muskan-agarwal26 changed the title websocket: New Generic Integration websocket: new generic integration May 21, 2024
@ShourieG ShourieG added the Team:Security-Service Integrations Security Service Integrations Team label May 21, 2024
@elasticmachine
Copy link

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

@ShourieG ShourieG added New Integration integration Label used for meta issues tracking each integration Crest labels May 21, 2024
Comment on lines +17 to +22
```yaml
- type: websocket
url: "ws://websocket-server.example.com/stream"
headers:
Cookie: "session_id=abcdef1234567890"
```
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 not what the user will do AFAICS. I suggest that if you are using examples, use screen shots of the UI with values filled in. Though I think the standard textual approach should be fine so long as the relevant UI elements are described.

Also, this should show that the user will need to provide a CEL program to handle the messages. A minimal program that just passes the message unaltered to the output seems appropriate.


The WebSocket input will consume messages from the server as they are transmitted. These messages are expected to be in a format that Filebeat can process, such as JSON. If the message format is different, you may need to define a processor to parse and structure the data before it is sent to Elasticsearch.

**NOTE**: The websocket input as of now does not support XML messages.
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
**NOTE**: The websocket input as of now does not support XML messages.
**NOTE**: The websocket input does not support XML messages.

Do we plan to change this? @ShourieG I don't see any reason in principle why we can't.

Copy link
Contributor

Choose a reason for hiding this comment

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

@efd6, yes we definitely want to support XML in future but need to establish how popular XLM over ws is. I have seen very few instances of this. So this is definitely possible but need to figure out an use case where such a model would come in use.

Copy link
Contributor

Choose a reason for hiding this comment

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

Please go fmt this code.

Comment on lines +6 to +8
bytes(state.response).decode_json().as(inner_body,{
"events": inner_body,
})
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
bytes(state.response).decode_json().as(inner_body,{
"events": inner_body,
})
bytes(state.response).decode_json().as(body, {
"events": body,
})

@efd6
Copy link
Contributor

efd6 commented May 21, 2024

/test

@elasticmachine
Copy link

elasticmachine commented May 21, 2024

💔 Build Failed

Failed CI Steps

History

cc @muskan-agarwal26

service: websocket-mock-service
vars:
url: ws://{{Hostname}}:{{Port}}
program: |
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we also add a more robust test scenario that demonstrates more CEL usage ?

@@ -0,0 +1,83 @@
format_version: 3.0.2
name: websocket
title: Custom input using Websocket

Choose a reason for hiding this comment

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

Can we adjust the title to ensure it aligns with our other custom packages. Title should be Custom Websocket logs

Comment on lines +6 to +13
url: {{url}}

program: {{escape_string program}}

{{#if pipeline}}
pipeline: {{pipeline}}
{{/if}}

Copy link
Contributor

Choose a reason for hiding this comment

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

AFAICS not all configuration options supported by the input such as state, redact.*, regexp, auth.* are added. It would be nice to add all options to allow user to configure.

@@ -0,0 +1,34 @@
# WebSocket Input Integration
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
# WebSocket Input Integration
# Custom WebSocket Input

This is how we've been naming for other custom integrations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Crest integration Label used for meta issues tracking each integration New Integration Team:Security-Service Integrations Security Service Integrations Team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants