Merge pull request #469 from theopolis/logging-nits

Move expected errors to info log
This commit is contained in:
Teddy Reed 2014-11-19 14:54:32 -08:00
commit 9a6a69a224
3 changed files with 7 additions and 7 deletions

View File

@ -32,8 +32,8 @@ DEFINE_osquery_flag(string,
"The path to the pidfile for osqueryd.");
std::string getHostname() {
char hostname[256];
memset(hostname, 0, 255);
char hostname[256]; // Linux max should be 64.
memset(hostname, 0, 256);
gethostname(hostname, 255);
std::string hostname_string = std::string(hostname);
boost::algorithm::trim(hostname_string);

View File

@ -62,11 +62,11 @@ void launchQueries(const std::vector<OsqueryScheduledQuery>& queries,
const int64_t& second) {
for (const auto& q : queries) {
if (second % q.interval == 0) {
LOG(INFO) << "executing query: " << q.query;
LOG(INFO) << "Executing query: " << q.query;
int unix_time = std::time(0);
auto sql = SQL(q.query);
if (!sql.ok()) {
LOG(ERROR) << "error executing query (" << q.query
LOG(ERROR) << "Error executing query (" << q.query
<< "): " << sql.getMessageString();
continue;
}
@ -75,7 +75,7 @@ void launchQueries(const std::vector<OsqueryScheduledQuery>& queries,
auto status = dbQuery.addNewResults(sql.rows(), diff_results, unix_time);
if (!status.ok()) {
LOG(ERROR)
<< "error adding new results to database: " << status.toString();
<< "Error adding new results to database: " << status.toString();
continue;
}

View File

@ -99,8 +99,8 @@ QueryData genCronTab() {
std::vector<std::string> user_crons;
auto status = listFilesInDirectory(kUserCronsPath, user_crons);
if (!status.ok()) {
LOG(ERROR) << "Could not list user crons from: " << kUserCronsPath << " ("
<< status.what() << ")";
LOG(INFO) << "Could not list user crons from: " << kUserCronsPath << " ("
<< status.toString() << ")";
return results;
}