diff --git a/TrafficCapture/README.md b/TrafficCapture/README.md index 054902caf..bc0f19cec 100644 --- a/TrafficCapture/README.md +++ b/TrafficCapture/README.md @@ -96,7 +96,7 @@ The Migration Console can be used to access and help interpret the data from the The data generated from the replayer is stored on an Elastic File System volume shared between the Replayer and Migration Console. It is mounted to the Migration Console at the path `/shared_replayer_output`. The Replayer generates files named `output_tuples.log`. -These files are rolled over as they hit 10 Mb to a series of `output_tuples-%d{yyyy-MM-dd-HH:mm}.log` files. +These files are rolled over as they hit 10 MB to a series of `output_tuples-%d{yyyy-MM-dd-HH:mm}.log` files. The data in these files is in the format of JSON lines, each of which is a log message containing a specific request-response-response tuple. The body of the messages is sometimes gzipped which makes it difficult to represent as text in a JSON. Therefore, the body field of all requests @@ -117,7 +117,7 @@ options: -h, --help show this help message and exit --outfile OUTFILE Path for output human readable tuple file. -# By default, the output file is the same path as the input file, but the file name is preface with `readable-`. +# By default, the output file is the same path as the input file, but the file name is prefixed with `readable-`. $ ./humanReadableLogs.py /shared_replayer_output/tuples.log Input file: /shared_replayer_output/tuples.log; Output file: /shared_replayer_output/readable-tuples.log diff --git a/TrafficCapture/dockerSolution/src/main/docker/migrationConsole/Dockerfile b/TrafficCapture/dockerSolution/src/main/docker/migrationConsole/Dockerfile index cf2857208..fc344b343 100644 --- a/TrafficCapture/dockerSolution/src/main/docker/migrationConsole/Dockerfile +++ b/TrafficCapture/dockerSolution/src/main/docker/migrationConsole/Dockerfile @@ -8,8 +8,8 @@ RUN apt-get update && \ COPY runTestBenchmarks.sh /root/ COPY humanReadableLogs.py /root/ -RUN chmod ugo+x /root/runTestBenchmarks.sh -RUN chmod ugo+x /root/humanReadableLogs.py +RUN chmod ug+x /root/runTestBenchmarks.sh +RUN chmod ug+x /root/humanReadableLogs.py WORKDIR /root CMD tail -f /dev/null \ No newline at end of file diff --git a/TrafficCapture/dockerSolution/src/main/docker/migrationConsole/humanReadableLogs.py b/TrafficCapture/dockerSolution/src/main/docker/migrationConsole/humanReadableLogs.py index 2c38a318e..badf521c0 100755 --- a/TrafficCapture/dockerSolution/src/main/docker/migrationConsole/humanReadableLogs.py +++ b/TrafficCapture/dockerSolution/src/main/docker/migrationConsole/humanReadableLogs.py @@ -107,7 +107,7 @@ def parse_body_value(raw_value: str, content_encoding: Optional[str], return decoded -def parse_tuple(line: str, line_no: int): +def parse_tuple(line: str, line_no: int) -> dict: item = json.loads(line) message = item[LOG_JSON_TUPLE_FIELD] tuple = json.loads(message) @@ -143,4 +143,4 @@ def parse_tuple(line: str, line_no: int): with open(args.infile, 'r') as in_f: with open(outfile, 'w') as out_f: for i, line in tqdm(enumerate(in_f)): - print(parse_tuple(line, i + 1), file=out_f) + print(json.dumps(parse_tuple(line, i + 1)), file=out_f)