2014-07-31 00:35:19 +00:00
|
|
|
// Copyright 2004-present Facebook. All Rights Reserved.
|
|
|
|
|
2014-09-10 01:54:53 +00:00
|
|
|
#pragma once
|
2014-07-31 00:35:19 +00:00
|
|
|
|
|
|
|
#include <future>
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
2014-08-05 23:13:55 +00:00
|
|
|
#include "osquery/status.h"
|
2014-07-31 00:35:19 +00:00
|
|
|
#include "osquery/database.h"
|
|
|
|
|
2014-08-15 07:25:30 +00:00
|
|
|
namespace osquery {
|
2014-07-31 00:35:19 +00:00
|
|
|
|
2014-09-16 07:28:23 +00:00
|
|
|
/**
|
|
|
|
* @brief A string which represents the default logger receiver
|
2014-09-15 20:02:23 +00:00
|
|
|
*
|
2014-09-16 07:28:23 +00:00
|
|
|
* The logger plugin that you use to define your config receiver can be
|
|
|
|
* defined via a command-line flag, however, if you don't define a logger
|
|
|
|
* plugin to use via the command-line, then the logger receiver which is
|
|
|
|
* represented by the string stored kDefaultLogReceiverName will be used.
|
2014-09-15 20:02:23 +00:00
|
|
|
*/
|
2014-07-31 00:35:19 +00:00
|
|
|
extern const std::string kDefaultLogReceiverName;
|
|
|
|
|
2014-09-16 07:28:23 +00:00
|
|
|
/**
|
|
|
|
* @brief Log a string using the default logger receiver.
|
2014-09-15 20:02:23 +00:00
|
|
|
*
|
2014-09-16 07:28:23 +00:00
|
|
|
* Note that this method should only be used to log results. If you'd like to
|
|
|
|
* log normal osquery operations, use Google Logging.
|
2014-09-15 20:02:23 +00:00
|
|
|
*
|
2014-09-16 07:28:23 +00:00
|
|
|
* @param s the string to log
|
2014-09-15 20:02:23 +00:00
|
|
|
*
|
2014-09-16 07:28:23 +00:00
|
|
|
* @return an instance of osquery::Status, indicating the success or failure
|
|
|
|
* of the operation.
|
2014-09-15 20:02:23 +00:00
|
|
|
*/
|
2014-08-05 23:13:55 +00:00
|
|
|
osquery::Status logString(const std::string& s);
|
2014-09-15 20:02:23 +00:00
|
|
|
|
2014-09-16 07:28:23 +00:00
|
|
|
/**
|
|
|
|
* @brief Log a string using a specific logger receiver.
|
2014-09-15 20:02:23 +00:00
|
|
|
*
|
2014-09-16 07:28:23 +00:00
|
|
|
* Note that this method should only be used to log results. If you'd like to
|
|
|
|
* log normal osquery operations, use Google Logging.
|
2014-09-15 20:02:23 +00:00
|
|
|
*
|
2014-09-16 07:28:23 +00:00
|
|
|
* @param s the string to log
|
|
|
|
* @param receiver a string representing the log receiver to use
|
2014-09-15 20:02:23 +00:00
|
|
|
*
|
2014-09-16 07:28:23 +00:00
|
|
|
* @return an instance of osquery::Status, indicating the success or failure
|
|
|
|
* of the operation.
|
2014-09-15 20:02:23 +00:00
|
|
|
*/
|
2014-08-15 07:25:30 +00:00
|
|
|
osquery::Status logString(const std::string& s, const std::string& receiver);
|
2014-07-31 00:35:19 +00:00
|
|
|
|
2014-09-16 07:28:23 +00:00
|
|
|
/**
|
|
|
|
* @brief Directly log results of scheduled queries to the default receiver
|
2014-09-15 20:02:23 +00:00
|
|
|
*
|
2014-09-16 07:28:23 +00:00
|
|
|
* @param item a struct representing the results of a scheduled query
|
2014-09-15 20:02:23 +00:00
|
|
|
*
|
2014-09-16 07:28:23 +00:00
|
|
|
* @return an instance of osquery::Status, indicating the success or failure
|
|
|
|
* of the operation.
|
2014-09-15 20:02:23 +00:00
|
|
|
*/
|
2014-08-05 23:13:55 +00:00
|
|
|
osquery::Status logScheduledQueryLogItem(
|
2014-09-21 21:27:09 +00:00
|
|
|
const osquery::ScheduledQueryLogItem& item);
|
2014-09-15 20:02:23 +00:00
|
|
|
|
2014-09-16 07:28:23 +00:00
|
|
|
/**
|
|
|
|
* @brief Directly log results of scheduled queries to a specified receiver
|
2014-09-15 20:02:23 +00:00
|
|
|
*
|
2014-09-16 07:28:23 +00:00
|
|
|
* @param item a struct representing the results of a scheduled query
|
|
|
|
* @param receiver a string representing the log receiver to use
|
2014-09-15 20:02:23 +00:00
|
|
|
*
|
2014-09-16 07:28:23 +00:00
|
|
|
* @return an instance of osquery::Status, indicating the success or failure
|
|
|
|
* of the operation.
|
2014-09-15 20:02:23 +00:00
|
|
|
*/
|
2014-08-05 23:13:55 +00:00
|
|
|
osquery::Status logScheduledQueryLogItem(
|
2014-09-21 21:29:28 +00:00
|
|
|
const osquery::ScheduledQueryLogItem& item, const std::string& receiver);
|
2014-08-15 07:25:30 +00:00
|
|
|
}
|