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 HTTP server output #19

Merged
merged 6 commits into from
May 28, 2021
Merged

Add HTTP server output #19

merged 6 commits into from
May 28, 2021

Conversation

marc-gr
Copy link
Contributor

@marc-gr marc-gr commented May 17, 2021

  • Tests
  • Changelog

@elasticmachine
Copy link

elasticmachine commented May 17, 2021

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview

Expand to view the summary

Build stats

  • Build Cause: Pull request #19 updated

  • Start Time: 2021-05-28T13:06:20.888+0000

  • Duration: 5 min 10 sec

  • Commit: dcbd546

Test stats 🧪

Test Results
Failed 0
Passed 5
Skipped 0
Total 5

Trends 🧪

Image of Build Times

Image of Tests

Copy link
Member

@andrewkroh andrewkroh left a comment

Choose a reason for hiding this comment

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

I tried it out for testing defender_atp. Worked for me. We should discuss how we want pagination and config to work.

command/root.go Show resolved Hide resolved
pkg/output/http/http.go Outdated Show resolved Hide resolved
@andrewkroh
Copy link
Member

Not sure if this is related to this output, but it hangs on SIGINT.

{"level":"debug","ts":"2021-05-21T08:47:28.666-0400","caller":"command/log.go:74","msg":"Sending log line.","address":"127.0.0.1:8081","log":"alert2.json","line_number":1}
^C^C^C^C^C^C^CError: waiting to write for too long

@marc-gr
Copy link
Contributor Author

marc-gr commented May 26, 2021

Not sure if this is related to this output, but it hangs on SIGINT.

{"level":"debug","ts":"2021-05-21T08:47:28.666-0400","caller":"command/log.go:74","msg":"Sending log line.","address":"127.0.0.1:8081","log":"alert2.json","line_number":1}
^C^C^C^C^C^C^CError: waiting to write for too long

Was missing to check the cmd context, this is fixed now 👍

@marc-gr
Copy link
Contributor Author

marc-gr commented May 26, 2021

I tried it out for testing defender_atp. Worked for me. We should discuss how we want pagination and config to work.

Currently this will just return the given logs in order, one request at a time, so pagination will be defined by the order of the logs you pass to the command.

This ignores the request URL or any other variable in the request as its initial intent is just to send the stream of logs through an http server output.

I'd like to have a more sophisticated tool that could be used to mock a specific server, with some routing and assertions, which I think is more in line with what we discussed in #9, I am unsure if this would belong here or as its own separate tool.

From my testing I think this initial approach might be enough for our current needs, WDYT?

@marc-gr marc-gr requested a review from andrewkroh May 26, 2021 10:51
@andrewkroh
Copy link
Member

I think all of that could be part of this tool. I think we should do the minimal required for our first set of test cases and then iterate on the development of features that we need to get the test coverage required. Since it's a test tool and primarily for our own consumption it will be fine if we need to break some of the config to refine it.

@andrewkroh
Copy link
Member

I noticed the README lists the "outputs". Can you update it to include http-server or remove the list of outputs.

@marc-gr marc-gr merged commit b890eac into elastic:main May 28, 2021
@marc-gr marc-gr deleted the http-output branch May 28, 2021 13:18
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