logswan

Fast Web log analyzer using probabilistic data structures
Log | Files | Refs | README | LICENSE

commit 72dbd0ff0a050e1d566eacfeb7d461d565be9aa1
parent bf77b17b45970610682af958a20dcc6a1a9a771a
Author: Frederic Cambus <fcambus@users.sourceforge.net>
Date:   Sat,  5 Dec 2015 18:44:05 +0100

Adding log file name in the JSON output

Diffstat:
Msrc/logswan.c | 3++-
Msrc/output.c | 3++-
Msrc/results.h | 3++-
3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/logswan.c b/src/logswan.c @@ -4,7 +4,7 @@ /* https://github.com/fcambus/logswan */ /* */ /* Created: 2015/05/31 */ -/* Last Updated: 2015/11/12 */ +/* Last Updated: 2015/12/05 */ /* */ /* Logswan is released under the BSD 3-Clause license. */ /* See LICENSE file for details. */ @@ -107,6 +107,7 @@ int main (int argc, char *argv[]) { /* Get log file size */ stat(intputFile, &logFileSize); + results.fileName = intputFile; results.fileSize = (uint64_t)logFileSize.st_size; if (!(logFile = fopen(intputFile, "r"))) { diff --git a/src/output.c b/src/output.c @@ -4,7 +4,7 @@ /* https://github.com/fcambus/logswan */ /* */ /* Created: 2015/05/31 */ -/* Last Updated: 2015/11/02 */ +/* Last Updated: 2015/12/05 */ /* */ /* Logswan is released under the BSD 3-Clause license. */ /* See LICENSE file for details. */ @@ -68,6 +68,7 @@ char *output(Results results) { json_object_set_new(jsonObject, "date", json_string(results.timeStamp)); json_object_set_new(jsonObject, "generator", json_string(VERSION)); + json_object_set_new(jsonObject, "file_name", json_string(results.fileName)); json_object_set_new(jsonObject, "file_size", json_integer(results.fileSize)); json_object_set_new(jsonObject, "processed_lines", json_integer(results.processedLines)); json_object_set_new(jsonObject, "invalid_lines", json_integer(results.invalidLines)); diff --git a/src/results.h b/src/results.h @@ -4,7 +4,7 @@ /* https://github.com/fcambus/logswan */ /* */ /* Created: 2015/05/31 */ -/* Last Updated: 2015/12/04 */ +/* Last Updated: 2015/12/05 */ /* */ /* Logswan is released under the BSD 3-Clause license. */ /* See LICENSE file for details. */ @@ -15,6 +15,7 @@ #define RESULTS_H struct results { + char *fileName; uint64_t fileSize; uint64_t invalidLines; uint64_t processedLines;