This repo contains the source to the file parser service that reads a log file and stores it's content to a DB and exposes the data via a resful API using embedded Jetty web server achieved through SparkJava
You will need the below to build and run the service
- Gradle 4 or higher
- JDK 8 or higher
- Clone the Repository from Github
$ cd file-parser-service
$ gradle fatJar
APIPORT
the port used to expose the resfful API.ProcessedLogFilesPath
the path where processed log files are moved.
hibernate.connection.driver_class
JDBC driver class.hibernate.connection.url
JDBC URL to the database instance.hibernate.connection.username
database username.hibernate.connection.password
database password.hibernate.dialect
makes Hibernate generate the appropriate SQL for the chosen database.
Run the command
java -jar{path to jar file}
- Request type POST
- Request attribute - Multipart key logFile
- Route -
/api/v1/logEntries/upload
#Get Data
- Request type GET
- Params (optional)
page_size
offset
- Route -
/api/v1/logEntries
CREATE TABLE logs( id INT AUTO_INCREMENT not null PRIMARY KEY, request_params varchar(200) not null, request_ip varchar(30) not null, performance_metrics varchar(20) not null, UNIQUE (request_params,request_ip,performance_metrics));