Cherry-pick #15845 to 7.x: SQL module now supports key/value mode #15870
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 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 of the response.Checklist
How to test this PR locally
Having a mysql database, enable and configure que
sql
module with console as output, variable mode and querySHOW STATUS
.For example
Running
metricbeat -e
you will see only one event with all key/value pairs:This PR introduces a new configuration option called
sql_response_format
with 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