mirror of
https://github.com/zeek/zeek.git
synced 2025-10-03 23:28:20 +00:00
Adding Broker ifdefs for new remote logging code.
This commit is contained in:
parent
a5e9a535a5
commit
511ca9e043
5 changed files with 16 additions and 2 deletions
|
@ -1207,7 +1207,11 @@ WriterFrontend* Manager::CreateWriter(EnumVal* id, EnumVal* writer, WriterBacken
|
||||||
winfo->info->rotation_interval = winfo->interval;
|
winfo->info->rotation_interval = winfo->interval;
|
||||||
winfo->info->rotation_base = parse_rotate_base_time(base_time);
|
winfo->info->rotation_base = parse_rotate_base_time(base_time);
|
||||||
|
|
||||||
|
#ifdef ENABLE_BROKER
|
||||||
winfo->writer = new WriterFrontend(*winfo->info, id, writer, local, remote, stream->remote_flags);
|
winfo->writer = new WriterFrontend(*winfo->info, id, writer, local, remote, stream->remote_flags);
|
||||||
|
#else
|
||||||
|
winfo->writer = new WriterFrontend(*winfo->info, id, writer, local, remote, 0);
|
||||||
|
#endif
|
||||||
winfo->writer->Init(num_fields, fields);
|
winfo->writer->Init(num_fields, fields);
|
||||||
|
|
||||||
InstallRotationTimer(winfo);
|
InstallRotationTimer(winfo);
|
||||||
|
|
|
@ -131,7 +131,7 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new log writer frontend. This is exposed so that the
|
* Create a new log writer frontend. This is exposed so that the
|
||||||
* communication system can recreated remote log streams locally.
|
* communication system can recreate remote log streams locally.
|
||||||
*
|
*
|
||||||
* @param stream The enum value corresponding the log stream.
|
* @param stream The enum value corresponding the log stream.
|
||||||
*
|
*
|
||||||
|
@ -153,7 +153,7 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Writes out log entries that have already passed through all
|
* Writes out log entries that have already passed through all
|
||||||
* filters, and have raised any events. This is meant called for logs
|
* filters (and have raised any events). This is meant called for logs
|
||||||
* received alrready processed from remote.
|
* received alrready processed from remote.
|
||||||
*
|
*
|
||||||
* @param stream The enum value corresponding the log stream.
|
* @param stream The enum value corresponding the log stream.
|
||||||
|
|
|
@ -119,6 +119,7 @@ bool WriterBackend::WriterInfo::Write(SerializationFormat* fmt) const
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef ENABLE_BROKER
|
||||||
broker::data WriterBackend::WriterInfo::ToBroker() const
|
broker::data WriterBackend::WriterInfo::ToBroker() const
|
||||||
{
|
{
|
||||||
auto bpath = broker::record::field(path);
|
auto bpath = broker::record::field(path);
|
||||||
|
@ -175,6 +176,7 @@ bool WriterBackend::WriterInfo::FromBroker(broker::data d)
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
WriterBackend::WriterBackend(WriterFrontend* arg_frontend) : MsgThread()
|
WriterBackend::WriterBackend(WriterFrontend* arg_frontend) : MsgThread()
|
||||||
{
|
{
|
||||||
|
|
|
@ -6,7 +6,10 @@
|
||||||
#define LOGGING_WRITERBACKEND_H
|
#define LOGGING_WRITERBACKEND_H
|
||||||
|
|
||||||
#include "threading/MsgThread.h"
|
#include "threading/MsgThread.h"
|
||||||
|
|
||||||
|
#ifdef ENABLE_BROKER
|
||||||
#include "broker/Data.h"
|
#include "broker/Data.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "Component.h"
|
#include "Component.h"
|
||||||
|
|
||||||
|
@ -115,8 +118,11 @@ public:
|
||||||
// fields. They serialize/deserialize the struct.
|
// fields. They serialize/deserialize the struct.
|
||||||
bool Read(SerializationFormat* fmt);
|
bool Read(SerializationFormat* fmt);
|
||||||
bool Write(SerializationFormat* fmt) const;
|
bool Write(SerializationFormat* fmt) const;
|
||||||
|
|
||||||
|
#ifdef ENABLE_BROKER
|
||||||
broker::data ToBroker() const;
|
broker::data ToBroker() const;
|
||||||
bool FromBroker(broker::data d);
|
bool FromBroker(broker::data d);
|
||||||
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const WriterInfo& operator=(const WriterInfo& other); // Disable.
|
const WriterInfo& operator=(const WriterInfo& other); // Disable.
|
||||||
|
|
|
@ -214,12 +214,14 @@ void WriterFrontend::Write(int arg_num_fields, Value** vals)
|
||||||
num_fields,
|
num_fields,
|
||||||
vals);
|
vals);
|
||||||
|
|
||||||
|
#ifdef ENABLE_BROKER
|
||||||
broker_mgr->Log(stream,
|
broker_mgr->Log(stream,
|
||||||
writer,
|
writer,
|
||||||
info->path,
|
info->path,
|
||||||
num_fields,
|
num_fields,
|
||||||
vals,
|
vals,
|
||||||
remote_flags);
|
remote_flags);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! backend )
|
if ( ! backend )
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue