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

update dataflatten tables to parse raw_data in query #1732

Merged
merged 5 commits into from
Jun 4, 2024

Conversation

James-Pickett
Copy link
Contributor

@James-Pickett James-Pickett commented May 31, 2024

allow for passing raw data into query for dataflatten tables

osquery> select * from kolide_json where raw_data = '[0]';
+---------+--------+-----+-------+-------+------+----------+
| fullkey | parent | key | value | query | path | raw_data |
+---------+--------+-----+-------+-------+------+----------+
| 0       |        | 0   | 0     | *     |      | [0]      |
+---------+--------+-----+-------+-------+------+----------+
osquery> select * from kolide_json where raw_data = '{"hi":"there"}';
+---------+--------+-----+-------+-------+------+----------------+
| fullkey | parent | key | value | query | path | raw_data       |
+---------+--------+-----+-------+-------+------+----------------+
| hi      |        | hi  | there | *     |      | {"hi":"there"} |
+---------+--------+-----+-------+-------+------+----------------+

when adding both constraints with an OR, the first one wins unless there is a specific query

osquery> select * from kolide_json where path = '/tmp/test.json' or raw_data = '[0]';
+---------+--------+-----+-------+-------+----------------+----------+
| fullkey | parent | key | value | query | path           | raw_data |
+---------+--------+-----+-------+-------+----------------+----------+
| hi      |        | hi  | there | *     | /tmp/test.json |          |
+---------+--------+-----+-------+-------+----------------+----------+
osquery> select * from kolide_json where query = 0 and path = '/tmp/test.json' or raw_data = '[0]';
+---------+--------+-----+-------+-------+------+----------+
| fullkey | parent | key | value | query | path | raw_data |
+---------+--------+-----+-------+-------+------+----------+
| 0       |        | 0   | 0     | *     |      | [0]      |
+---------+--------+-----+-------+-------+------+----------+

not sure if this is the expected behavior

Copy link
Contributor

@directionless directionless left a comment

Choose a reason for hiding this comment

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

I think probably good enough

ee/tables/dataflattentable/tables.go Outdated Show resolved Hide resolved
ee/tables/dataflattentable/tables.go Outdated Show resolved Hide resolved
@James-Pickett James-Pickett marked this pull request as ready for review June 3, 2024 21:49
directionless
directionless previously approved these changes Jun 4, 2024
Copy link
Contributor

@directionless directionless left a comment

Choose a reason for hiding this comment

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

I think it's good

ee/tables/dataflattentable/tables.go Outdated Show resolved Hide resolved
Copy link
Contributor

@RebeccaMahany RebeccaMahany left a comment

Choose a reason for hiding this comment

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

Just a couple questions to understand the changes better, but overall this looks good to me 🙂

ee/tables/dataflattentable/tables.go Show resolved Hide resolved
ee/tables/dataflattentable/tables.go Show resolved Hide resolved
@James-Pickett James-Pickett added this pull request to the merge queue Jun 4, 2024
Merged via the queue into kolide:main with commit a90ddf5 Jun 4, 2024
31 checks passed
@James-Pickett James-Pickett deleted the james/dataflatten-raw-data branch June 4, 2024 20:55
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.

4 participants