bootlog: setup cloudlog on keywords (#20898)

* bootlog: setup cloudlog on keywords

* just log
albatross
Adeeb Shihadeh 2021-05-14 01:02:08 -05:00 committed by GitHub
parent c4d00134ee
commit 2bc9b97aba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 0 deletions

View File

@ -16,6 +16,7 @@ static kj::Array<capnp::word> build_boot_log() {
std::map<std::string, std::string> pstore_map;
util::read_files_in_dir(pstore, &pstore_map);
const std::vector<std::string> log_keywords = {"Kernel panic"};
auto lpstore = boot.initPstore().initEntries(pstore_map.size());
int i = 0;
for (auto& kv : pstore_map) {
@ -23,6 +24,12 @@ static kj::Array<capnp::word> build_boot_log() {
lentry.setKey(kv.first);
lentry.setValue(capnp::Data::Reader((const kj::byte*)kv.second.data(), kv.second.size()));
i++;
for (auto &k : log_keywords) {
if (kv.second.find(k) != std::string::npos) {
LOGE("%s: found '%s'", kv.first.c_str(), k.c_str());
}
}
}
std::string launchLog = util::read_file("/tmp/launch_log");