json: use top-level sensor-name if provided.

Currently the default configuration file contains a "sensor-name"
at the root of the configuration file, however, eve-log will only
use it if its specified under eve-log.

Now we will look for it at the eve-log, if present we'll use it
but log a deprecation warning, if its not present we'll look
for sensor-name at the root of the configuration.
pull/1860/head
Jason Ish 10 years ago
parent 5f39728509
commit 3d2834a232

@ -435,7 +435,17 @@ OutputCtx *OutputJsonInitCtx(ConfNode *conf)
{
OutputJsonCtx *json_ctx = SCCalloc(1, sizeof(OutputJsonCtx));;
/* First lookup a sensor-name value in this outputs configuration
* node (deprecated). If that fails, lookup the global one. */
const char *sensor_name = ConfNodeLookupChildValue(conf, "sensor-name");
if (sensor_name != NULL) {
SCLogWarning(SC_ERR_DEPRECATED_CONF,
"Found deprecated eve-log setting \"sensor-name\". "
"Please set sensor-name globally.");
}
else {
ConfGet("sensor-name", (char **)&sensor_name);
}
if (unlikely(json_ctx == NULL)) {
SCLogDebug("AlertJsonInitCtx: Could not create new LogFileCtx");

@ -314,6 +314,7 @@ const char * SCErrorToString(SCError err)
CASE_CODE (SC_ERR_INVALID_RULE_ARGUMENT);
CASE_CODE (SC_ERR_STATS_LOG_NEGATED);
CASE_CODE (SC_ERR_JSON_STATS_LOG_NEGATED);
CASE_CODE (SC_ERR_DEPRECATED_CONF);
}
return "UNKNOWN_ERROR";

@ -304,6 +304,7 @@ typedef enum {
SC_ERR_MT_NO_MAPPING,
SC_ERR_STATS_LOG_NEGATED, /** When totals and threads are both NO in yaml **/
SC_ERR_JSON_STATS_LOG_NEGATED, /** When totals and threads are both NO in yaml **/
SC_ERR_DEPRECATED_CONF, /**< Deprecated configuration parameter. */
} SCError;
const char *SCErrorToString(SCError);

Loading…
Cancel
Save