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

profile.py: Log # of queries loaded and raise an error if 0 are loaded #7934

Merged
merged 2 commits into from
Feb 10, 2023

Conversation

tstromberg
Copy link
Contributor

This adds some diagnostic log and error messages to profile.py so that people can debug why profile.py is quietly exiting. In my case, it was because I was passing an osquery pack file to --config.

Old Behavior

Invalid config:

$ ./profile.py --shell /usr/bin/osqueryi --config pack.conf

Notice the lack of any output or error code.

Valid config:

$ ./profile.py --shell /usr/bin/osqueryi --config osquery.conf
Profiling query: SELECT hostname, cpu_brand, physical_memory FROM system_info;

New Behavior

Invalid config:

$ ./profile.py --shell /usr/bin/osqueryi --config pack.conf                       pack.conf parsed as JSON, but does not contain a 'schedule' or 'packs' stanza. Is it really an osquery configuration file?

Valid config:

$ ./profile.py --shell /usr/bin/osqueryi --config osquery.conf
1 query loaded from /etc/osquery/osquery.conf

Profiling query: SELECT hostname, cpu_brand, physical_memory FROM system_info;

@tstromberg tstromberg requested review from a team as code owners February 9, 2023 15:30
@directionless directionless merged commit 1951c79 into osquery:master Feb 10, 2023
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.

None yet

2 participants