Flush logs to ES daemon as Bro is shutting down.

This commit is contained in:
Seth Hall 2012-06-15 21:06:06 -04:00
parent a4df914ab7
commit ca5eb5382a

View file

@ -51,12 +51,12 @@ bool ElasticSearch::DoInit(string path, int num_fields, const Field* const * fie
bool ElasticSearch::DoFlush() bool ElasticSearch::DoFlush()
{ {
//TODO: Send flush command to ElasticSearch
return true; return true;
} }
bool ElasticSearch::DoFinish() bool ElasticSearch::DoFinish()
{ {
BatchIndex();
return WriterBackend::DoFinish(); return WriterBackend::DoFinish();
} }
@ -120,7 +120,7 @@ bool ElasticSearch::AddFieldValueToBuffer(Value* val, const Field* field)
{ {
char c = val->val.string_val->data()[i]; char c = val->val.string_val->data()[i];
// HTML entity encode special characters. // HTML entity encode special characters.
if ( c < 32 || c > 126 || c == '\n' || c == '"' || c == '\'' || c == '\\' ) if ( c < 32 || c > 126 || c == '\n' || c == '"' || c == '\'' || c == '\\' || c == '&' )
{ {
buffer.AddRaw("&#", 2); buffer.AddRaw("&#", 2);
buffer.Add((uint8_t) c); buffer.Add((uint8_t) c);