mirror of
https://github.com/zeek/zeek.git
synced 2025-10-05 08:08:19 +00:00
Changing semantics of Broker's remote logging to match old communication framework.
Broker had changed the semantics of remote logging: it sent over the original Bro record containing the values to be logged, which on the receiving side would then pass through the logging framework normally, including triggering filters and events. The old communication system however special-cases logs: it sends already processed log entries, just as they go into the log files, and without any receiver-side filtering etc. This more efficient as it short-cuts the processing path, and also avoids the more expensive Val serialization. It also lets the sender determine the specifics of what gets logged (and how). This commit changes Broker over to now use the same semantics as the old communication system. TODOs: - The new Broker code doesn't have consistent #ifdefs yet. - Right now, when a new log receiver connects, all existing logs are broadcasted out again to all current clients. That doesn't so any harm, but is unncessary. Need to add a way to send the existing logs to just the new client.
This commit is contained in:
parent
0dd0bfb5bb
commit
a5e9a535a5
25 changed files with 1178 additions and 159 deletions
|
@ -129,6 +129,52 @@ public:
|
|||
*/
|
||||
bool Write(EnumVal* id, RecordVal* columns);
|
||||
|
||||
/**
|
||||
* Create a new log writer frontend. This is exposed so that the
|
||||
* communication system can recreated remote log streams locally.
|
||||
*
|
||||
* @param stream The enum value corresponding the log stream.
|
||||
*
|
||||
* @param writer The enum value corresponding the desired log writer.
|
||||
*
|
||||
* @param info A fully initialized object defining the
|
||||
* characteristics of the backend writer instance. The method takes
|
||||
* ownership of this.
|
||||
*
|
||||
* @param num_fields The number of log fields to write.
|
||||
*
|
||||
* @param vals An arry of log fields to write, of size num_fields.
|
||||
* The method takes ownership of the arry.
|
||||
*
|
||||
* @return Returns true if the writer was successfully created.
|
||||
*/
|
||||
bool CreateWriterForRemoteLog(EnumVal* id, EnumVal* writer, WriterBackend::WriterInfo* info,
|
||||
int num_fields, const threading::Field* const* fields);
|
||||
|
||||
/**
|
||||
* Writes out log entries that have already passed through all
|
||||
* filters, and have raised any events. This is meant called for logs
|
||||
* received alrready processed from remote.
|
||||
*
|
||||
* @param stream The enum value corresponding the log stream.
|
||||
*
|
||||
* @param writer The enum value corresponding the desired log writer.
|
||||
*
|
||||
* @param path The path of the target log stream to write to.
|
||||
*
|
||||
* @param num_fields The number of log values to write.
|
||||
*
|
||||
* @param vals An arry of log values to write, of size num_fields.
|
||||
* The method takes ownership of the arry.
|
||||
*/
|
||||
bool WriteFromRemote(EnumVal* stream, EnumVal* writer, string path,
|
||||
int num_fields, threading::Value** vals);
|
||||
|
||||
/**
|
||||
* Announces all instantiated writers to a given Broker peer.
|
||||
*/
|
||||
void SendAllWritersTo(const string& peer);
|
||||
|
||||
/**
|
||||
* Sets log streams buffering state. This adjusts all associated
|
||||
* writers to the new state.
|
||||
|
@ -203,10 +249,6 @@ protected:
|
|||
int num_fields, const threading::Field* const* fields,
|
||||
bool local, bool remote, bool from_remote, const string& instantiating_filter="");
|
||||
|
||||
// Takes ownership of values..
|
||||
bool Write(EnumVal* id, EnumVal* writer, string path,
|
||||
int num_fields, threading::Value** vals);
|
||||
|
||||
// Announces all instantiated writers to peer.
|
||||
void SendAllWritersTo(RemoteSerializer::PeerID peer);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue