From d465c2f1a39f0e7f6a61a1eed43c28deed98b6a9 Mon Sep 17 00:00:00 2001 From: David Buckle Date: Tue, 27 Jun 2017 08:21:30 -0300 Subject: [PATCH] Removes the beauty of the JSON logging The beautify options makes the JSON easy to be read by human eyes. No need to have pretty print JSON for production, as beautify the JSON is not a hard task. Atop of that there are some disvantages to use the JSON in pretty format, as described on the issue: #1472 --- src/modsecurity.cc | 3 ++- src/transaction.cc | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/modsecurity.cc b/src/modsecurity.cc index d18a5d04..46c70700 100644 --- a/src/modsecurity.cc +++ b/src/modsecurity.cc @@ -221,7 +221,7 @@ int ModSecurity::processContentOffset(const char *content, size_t len, return -1; } - yajl_gen_config(g, yajl_gen_beautify, 1); + yajl_gen_config(g, yajl_gen_beautify, 0); yajl_gen_map_open(g); yajl_gen_string(g, reinterpret_cast("match"), @@ -367,6 +367,7 @@ int ModSecurity::processContentOffset(const char *content, size_t len, yajl_gen_get_buf(g, &buf, &jsonSize); json->assign(reinterpret_cast(buf), jsonSize); + json->append("\n"); yajl_gen_free(g); #else diff --git a/src/transaction.cc b/src/transaction.cc index f4cc76e7..23ff3ecc 100644 --- a/src/transaction.cc +++ b/src/transaction.cc @@ -1486,7 +1486,7 @@ std::string Transaction::toJSON(int parts) { if (g == NULL) { return ""; } - yajl_gen_config(g, yajl_gen_beautify, 1); + yajl_gen_config(g, yajl_gen_beautify, 0); /* main */ yajl_gen_map_open(g); @@ -1654,6 +1654,7 @@ std::string Transaction::toJSON(int parts) { yajl_gen_get_buf(g, &buf, &len); log.assign(reinterpret_cast(buf), len); + log.append("\n"); yajl_gen_free(g);