mirror of
https://github.com/valitydev/osquery-1.git
synced 2024-11-08 02:18:53 +00:00
Remove specific filenames from RocksDB IOErrors
This commit is contained in:
parent
e501507c87
commit
5728c93392
@ -272,6 +272,15 @@ Status DBHandle::Put(const std::string& domain,
|
|||||||
return Status(1, "Could not get column family for " + domain);
|
return Status(1, "Could not get column family for " + domain);
|
||||||
}
|
}
|
||||||
auto s = getDB()->Put(rocksdb::WriteOptions(), cfh, key, value);
|
auto s = getDB()->Put(rocksdb::WriteOptions(), cfh, key, value);
|
||||||
|
if (s.code() != 0 && s.IsIOError()) {
|
||||||
|
// An error occurred, check if it is an IO error and remove the offending
|
||||||
|
// specific filename or log name.
|
||||||
|
std::string error_string = s.ToString();
|
||||||
|
size_t error_pos = error_string.find_last_of(":");
|
||||||
|
if (error_pos != std::string::npos) {
|
||||||
|
return Status(s.code(), "IOError: " + error_string.substr(error_pos + 2));
|
||||||
|
}
|
||||||
|
}
|
||||||
return Status(s.code(), s.ToString());
|
return Status(s.code(), s.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -356,8 +356,7 @@ Status EventSubscriberPlugin::recordEvent(EventID& eid, EventTime time) {
|
|||||||
status = db->Put(
|
status = db->Put(
|
||||||
kEvents, record_key + "." + list_key + "." + list_id, record_value);
|
kEvents, record_key + "." + list_key + "." + list_id, record_value);
|
||||||
if (!status.ok()) {
|
if (!status.ok()) {
|
||||||
LOG(ERROR) << "Could not put Event Record key: " << record_key << "."
|
LOG(ERROR) << "Could not put Event Record key: " << record_key;
|
||||||
<< list_key << "." << list_id;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user