Search for question
Question

5/3/24, 11:49 AM Individual Project • Due May 11 by 11:59pm • Points 100 Objective Individual Project The goal is to develop a command-line application capable of parsing a log file (.txt extension) that contains different types of log entries (each line is a log entry), classifying these logs into specific categories, and then writing various kinds of aggregations based on these logs into output JSON files. The application will deal with APM (Application Performance Metrics) Logs, Application Logs, and Request Logs. The design should be able to support other log types and file formats in the future. Log File Composition 1. APM logs APM Logs depict various application performance metrics. They include CPU Usage Percentage, Memory Usage Percentage, and Disk Usage Percentage. The APM metrics don't are not just limited to these -- the application will have group the metrics by the key "metric" in the log line. Similarly, vale will be extracted from the key "value. The application will aggregate these metrics to calculate the minimum, median, average, and maximum values for each. Aggregations from this type of logs look like the following: { "cpu_usage_percent": { "minimum": 60, }, "median": 78, "average": 77, "max" : 90 "memory_usage_percent": { "median": 10, "minimum": 5, "average": 13.5, "max" : 78 } } 2. Application Logs Application Logs capture events related to the application's operations. These logs can include errors, warnings, and informational messages that provide insights into the application's behavior and health. https://sjsu.instructure.com/courses/1585892/assignments/6965693 1/4 5/3/24, 11:49 AM Aggregations for Application Logs include: • Count of logs by severity level (Error, Warning, Info) An example of aggregations from Application Logs: { "ERROR": 2, "INFO": 3, "DEBUG": 1, "WARNING": 1 } Individual Project 3. Request Logs Request Logs detail the requests made to the application, including information such as request type, endpoint, response time, and status code. Aggregations for Request Logs include: • Average, median, min, and max response times per API route. • Count of requests by HTTP status code category (e.g., 2xx, 4xx, 5xx) per API route. Example aggregation from Request Logs: } { "/api/update": { "response_times": { "min": 200, }, "50_percentile": 200, "90_percentile": 200, "95 percentile": 200, "99_percentile": 200, "max" : 200 "status_codes": { "2XX": 1, '4XX": 0, "5XX": 0 } }, "/api/status": { "response_times": { "min": 100, "50_percentile": 100, }, "90_percentile": 100, "95_percentile": 100, "99_percentile": 100, "max" : 100 "status_codes": { "2XX": 1, "4XX": 0, '5XX": 0 } } https://sjsu.instructure.com/courses/1585892/assignments/6965693 2/4 5/3/24, 11:49 AM Sample Log File Individual Project timestamp=2024-02-24T16:22:15Z metric=cpu_usage_percent host=webserver1 value=72 timestamp=2024-02-24T16:22:20Z level=INFO message="Scheduled maintenance starting" host=webserver1 timestamp=2024-02-24T16:22:25Z request_method=POST request_url="/api/update" response_status=202 response_tim e_ms=200 host=webserver1 timestamp=2024-02-24T16:22:30Z metric-memory_usage_percent host=webserver1 value=85 timestamp=2024-02-24T16:22:35Z level=ERROR message="Update process failed" error_code=5012 host=webserver1 timestamp=2024-02-24T16:22:40Z request_method=GET request_url="/api/status" response_status=200 response_time _ms=100 host=webserver1 timestamp=2024-02-24T16:22:45Z metric-disk_usage_percent mountpoint=/ host=webserver1 value=68 timestamp=2024-02-24T16:22:50Z level=DEBUG_message="Retrying update process" attempt=1 host=webserver1 timestamp=2024-02-24T16:22:55Z request_method=POST request_url="/api/retry" response_status=503 response_time ms=250 host=webserver1 host=webserver1 timestamp=2024-02-24T16:23:00Z metric-network_bytes_in host=webserver1 interface=eth0 value=543210 timestamp=2024-02-24T16:23:05Z level=INFO message="Update process completed successfully" host=webserver1 timestamp=2024-02-24T16:23:10Z request_method=GET request_url="/home" response_status=404 response_time_ms=25 timestamp=2024-02-24T16:23:15Z metric=network_bytes_out host=webserver1 interface=eth0 value=123456 timestamp=2024-02-24T16:23:20Z level=WARNING message="High memory usage detected" host=webserver1 timestamp=2024-02-24T16:23:25Z request_method=GET request_url="/api/status" response_status=200 response_time _ms=150 host=webserver1 timestamp=2024-02-24T16:23:30Z metric=cpu_usage_percent host=webserver2 value=65 timestamp=2024-02-24T16:23:35Z level=ERROR_message="Database connection timeout" host=webserver2 timestamp=2024-02-24T16:23:40Z request_method=POST request_url="/api/status" response_status=500 response_tim e_ms=300 host=webserver2 timestamp=2024-02-24T16:23:45Z metric-memory_usage_percent host=webserver2 value=90 timestamp=2024-02-24T16:23:50Z level=INFO message="New user registered" user_id=789 host=webserver2 timestamp=2024-02-24T16:23:55Z request_method=GET request_url="/api/status" response_status=200 response_time _ms=180 host=webserver2 Note: The log file may contain lines that are corrupted or incompatible with the specified log types. Our application will simply ignore these. Application spec: Input: The application accepts two command-line arguments: 1. Input: Input file name, specified by --file <filename.txt> For eg., if the file name is input.txt, the CLI args will be -file input.txt 2. Output: For each log type, a separate json file is created: ○ apm.json for APM logs ○ ○ request.json for Request logs application.json for Application logs Note: The output files will be created even when there are no logs of a certain type. Deliverables https://sjsu.instructure.com/courses/1585892/assignments/6965693 3/4 344 5/3/24, 11:49 AM Part I (25 points) Answer/outline the following: • Describe what problem you're solving. • What design pattern(s) will be used to solve this? Individual Project • Describe the consequences of using this/these pattern(s). • Create a class diagram - showing your classes and the Chosen design pattern Upload a PDF document containing the text answers and Class diagram in your Git repo. You may use Astah tool for the diagrams. Part II (75 points) Implement an application (Java code and JUnit tests) for Part 1. Output should contain the details specified in the project description. (https://classroom.github.com/a/1QoVRp17) You do not need to submit anything on Canvas, please checkin the PDF document for part 1 into your Github repository. Individual project demo time slots and signup sheet will be published later. To create your repository, please use this link: https://classroom.github.com/a/1QoVRpl7 & (https://classroom.github.com/a/1QoVRp17) https://sjsu.instructure.com/courses/1585892/assignments/6965693 4/4/nInstructions: Part 1 is to answer the question based on the project and class diagram, Part 2 is we need to do the implementation in Java For class diagram you can use draw.io, Astah etc Any IDE is fine, it should be command line application capable of parsing a log file need the code file and output files and the process to run it

Fig: 1