Add gzip log writing to the ascii writer.

This feature can be enabled globally for all logs by setting
LogAscii::gzip_level to a value greater than 0.

This feature can be enabled on a per-log basis by setting gzip-level in
$confic to a value greater than 0.
This commit is contained in:
Johanna Amann 2017-04-24 13:12:49 -07:00
parent 2c2c9c9052
commit c868a19a28
7 changed files with 191 additions and 8 deletions

View file

@ -8,6 +8,7 @@
#include "logging/WriterBackend.h"
#include "threading/formatters/Ascii.h"
#include "threading/formatters/JSON.h"
#include "zlib.h"
namespace logging { namespace writer {
@ -42,8 +43,11 @@ private:
void InitConfigOptions();
bool InitFilterOptions();
bool InitFormatter();
bool InternalWrite(int fd, const char* data, int len);
bool InternalClose(int fd);
int fd;
gzFile gzfile;
string fname;
ODesc desc;
bool ascii_done;
@ -59,6 +63,7 @@ private:
string unset_field;
string meta_prefix;
int gzip_level; // level > 0 enables gzip compression
bool use_json;
string json_timestamps;