-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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 support for Logstash as a valid Agent destination #24305
Conversation
This pull request doesn't have a |
💚 Build Succeeded
Expand to view the summary
Build stats
Test stats 🧪
Trends 🧪💚 Flaky test reportTests succeeded. Expand to view the summary
Test stats 🧪
|
@jsvd @roaksoax Hello, I've fixed the problem with Elastic Agent when Logstash was selected as the default destination, this allow logstash to receive both normal data stream document and monitoring document. I am looking at the e2e testing for this new output is this something we could contribute together? |
@andsel can you please take over this? |
Hi @ph great to know about this, I think I could get a copy of this branch, build and test it locally, to check that the connection between Elastic Agent and Logstash is fine. |
/package |
16a9288
to
553ff45
Compare
/package |
@andsel I just rebased this branch on top of master, will you take a look at elastic/e2e-testing#364 to automate it? I remember that Logstash had an integration test in the Beats plugin itself so we need to figure out what we do with this change. |
In Logstash we integration tests that runs Filebeat and Elasticsearch, I think we could add one to have Elastic Agent pushing to Logstash and to Elasticsearch. Did you mean that? |
Yes this is exactly what I mean. |
Pinging @elastic/agent (Team:Agent) |
@michalpristas this is ready for review. |
} else { | ||
typeValue = elasticsearchKey | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit; It seems we have this pattern in more than one place. How about introducing a transpiler.LookupString(ast, key) (contents string, ok bool)
?
if found { | ||
v, ok := t.Value().(*transpiler.StrVal) | ||
if !ok { | ||
return programsToRun, nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be an error? It looks we hit this line if someone did not follow the config format schema. If so we should rather fail instead of continuing with some 'internal' state that is difficult to understand for the user.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This indeed should error, I've tried refactoring in this PR but it became a mess, I will create a followup issue so we can consider this as techdebt and refactor it.
@@ -171,6 +171,85 @@ GROUPLOOP: | |||
} | |||
} | |||
|
|||
func TestMonitoringToLogstashInjection(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A test with an invalid configuration might be nice to have.
This pull request is now in conflicts. Could you fix it? 🙏
|
brought it even with top before review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tested with local logstash and i can see logs/metrics getting in
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please revisit getMonitoringSteps
@michalpristas for |
in get monitoring steps there's part of the code which extracts elasticsearch output. it is hardcoded to extract elasticsearch output. this extracted output is then passed to generate method which composes configuration for monitoring beats. the output extracted in first step is used and passed forward
also in the same file we use hardcoded |
This PR fixes an issue to use an logstash output as a monitoring destination, this correctly uses the type defined in the output to generate the appropriate output configuration for the monitoring processes.
b6f385c
to
ecc6140
Compare
/package |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please fix tests, go vet ./...
tells you what's wrong.
other than that code looks good
I think something is off, when I was doing testing.
OK, I've made a change locally to |
the monitoring sidecar
Replace the idiom of using Lookup and type cast into a string by a single method call.
@michalpristas Can you do another review please using a real logstash instance. I've put a working configuration in the description above. I want more tests to make sure we don't have a regression. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tested with ES and LS outputs, everything seems to be working fine
Merging this and creating followup issues. |
* Add support for Logstash as a valid Agent destination This PR fixes an issue to use an logstash output as a monitoring destination, this correctly uses the type defined in the output to generate the appropriate output configuration for the monitoring processes. (cherry picked from commit 9de1352)
* Add support for Logstash as a valid Agent destination This PR fixes an issue to use an logstash output as a monitoring destination, this correctly uses the type defined in the output to generate the appropriate output configuration for the monitoring processes. (cherry picked from commit 9de1352) Co-authored-by: Pier-Hugues Pellerin <[email protected]>
This PR fixes an issue to use an logstash output as a monitoring
destination, this correctly uses the type defined in the output to
generate the appropriate output configuration for the monitoring
processes.
Fixes: 22051
What does this PR do?
Why is it important?
Checklist
CHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.Author's Checklist
How to test this PR locally
Start logstash with this configuration:
Related issues
Use cases
Screenshots
Logs