Cherry-pick #15845 to 7.x: SQL module now supports key/value mode#15870
Merged
jsoriano merged 2 commits intoelastic:7.xfrom Jan 27, 2020
Merged
Cherry-pick #15845 to 7.x: SQL module now supports key/value mode#15870jsoriano merged 2 commits intoelastic:7.xfrom
jsoriano merged 2 commits intoelastic:7.xfrom
Conversation
There are some queries like mysql `SHOW STATUS` that display the results in a key/value format so they need to be scanned in a different way, being the key the first column of the response and the value the second one. (cherry picked from commit d8517c6)
kaiyan-sheng
approved these changes
Jan 27, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cherry-pick of PR #15845 to 7.x branch. Original message:
What does this PR do?
This PR allows to SQL generic module to send events correctly when the query return results in the way of key/values format.
Why is it important?
Because there are some querys like mysql
SHOW STATUSthat display the results in a key/value format so they need to be scanned in a different way, being the key the first column of the response and the value the second one of the response.Checklist
How to test this PR locally
Having a mysql database, enable and configure que
sqlmodule with console as output, variable mode and querySHOW STATUS.For example
Running
metricbeat -eyou will see only one event with all key/value pairs:This PR introduces a new configuration option called
sql_response_formatwith 2 available values:Any other value will exit with an error. The configuration option and their values were suggested in the issue #15770
Related issues