Skip to content

Conversation

@lucasmrod
Copy link
Contributor

@lucasmrod lucasmrod commented Jun 11, 2025

Fixes fleetdm/fleet#28577.

TL;DR: When hash table is used as scheduled query, the generated WARNING logs fill up the disk space.

Sample:
Without --verbose:

sudo ./osquery/osqueryi

osquery> SELECT * FROM hash WHERE path = '/Users/lucas/Downloads/Win11_24H2_English_Arm64.iso';
+-----------------------------------------------------+------------------------+-----+------+--------+
| path                                                | directory              | md5 | sha1 | sha256 |
+-----------------------------------------------------+------------------------+-----+------+--------+
| /Users/lucas/Downloads/Win11_24H2_English_Arm64.iso | /Users/lucas/Downloads |     |      |        |
+-----------------------------------------------------+------------------------+-----+------+--------+

With --verbose:

sudo ./osquery/osqueryi --verbose

osquery> SELECT * FROM hash WHERE path = '/Users/lucas/Downloads/Win11_24H2_English_Arm64.iso';
I0611 10:23:41.937412 -289448192 hashing.cpp:133] Failed to hash /Users/lucas/Downloads/Win11_24H2_English_Arm64.iso: Cannot read /Users/lucas/Downloads/Win11_24H2_English_Arm64.iso size exceeds limit: 5460387840 > 52428800
+-----------------------------------------------------+------------------------+-----+------+--------+
| path                                                | directory              | md5 | sha1 | sha256 |
+-----------------------------------------------------+------------------------+-----+------+--------+
| /Users/lucas/Downloads/Win11_24H2_English_Arm64.iso | /Users/lucas/Downloads |     |      |        |
+-----------------------------------------------------+------------------------+-----+------+--------+

@zwass zwass merged commit 8458718 into master Jun 11, 2025
27 checks passed
@zwass zwass deleted the 28577-reduce-hash-table-log-noise branch June 11, 2025 22:26

if (!status.ok()) {
LOG(WARNING) << "Failed to hash " << path;
VLOG(1) << "Failed to hash " << path << ": " << status.getMessage();
Copy link
Member

Choose a reason for hiding this comment

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

I know this merged, but I think this might not be the right thing here.

You're example, size exceeds limit feels routine, and thus maybe does belong down on VLOG, but what if there's a different error? Should that be on WARNING?

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.

osquery: Errors from hash table should only be logged when DEBUGing

4 participants