Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

-Please create a Parser that accepts Log files in Java!!!! This task is to build an executable jar then create the parser class. See details

-Please create a Parser that accepts Log files in Java!!!!

This task is to build an executable jar then create the parser class. See details below under Java Parser Application.

Additional tasks will be created to:

write unit tests, import the new project into GIT.

Java Parser Application

Summary

A command line executable jar file that accepts a list of SC log files on the command line, parses the files, and creates CSV files for import into a MySQL database. The input will be a list of SC log file names, and the output will be one new CSV file per log.

Execution Example

java -jar SCLogParser.jar IShipmentProcessor.log.20181026.snowbird16.gz IShipmentProcessor.log.20181026.snowbird18.gz

Which would create the following files.

sp.20181026.snowbird16.csv

sp.20181026.snowbird18.csv

Input

The parser will read the logs files to find lines matching the following patterns. Any log line that contains SPI::[command] should be converted into

{"Time":"11/16/2018 07:18:54:472","App":"SC","Sev":"INFO ","Host":"gaalpltapp00081","Instance":"Ship-Staging-shc_st5_1","Thread":"[[ACTIVE] ExecuteThread: '15' for queue: 'weblogic.kernel.Default (self-tuning)']","class":"c.u.s.nsf.RequestProcessorServer","Component":"SI","Msg":"[ClientName: SC_TEST ] SPI::process total time: 407"}

{"Time":"11/16/2018 07:18:54:472","App":"SC","Sev":"INFO ","Host":"gaalpltapp00081","Instance":"Ship-Staging-shc_st5_1","Thread":"[[ACTIVE] ExecuteThread: '15' for queue: 'weblogic.kernel.Default (self-tuning)']","class":"c.u.s.nsf.RequestProcessorServer","Component":"SI","Msg":"[ClientName: XOLT ] SPI::pre-process total time: 544"}

CSV File Output

Time, Host, Instance, Client, CallName, Duration

11/16/2018 07:18:54:472, gaalpltapp00081, Ship-Staging-shc_st5_1, SC_TEST, process, 407

11/16/2018 07:18:54:472, gaalpltapp00081, Ship-Staging-shc_st5_1, XOLT, pre-process, 544

Design Suggestions

The parser application should keep the parsing logic in a separate class that works with an InputStream and an OutputStream. The input will be the log data read from the gz file, while the output should be a CSV formatted string.

Grab a few hundred or so log lines from one of the SC files to add to the project. Write a unit test that exercises the code with the test file.

Save data to *.csv.temp and then rename to *.csv when complete so we know the job completed successfully or if it needs to be rerun

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

Convert ( AB ) ' to a NOR gate

Answered: 1 week ago