Code Monkey home page Code Monkey logo

unomok's Introduction

Authored by

Kajal

Log Digestion

This repository contains TypeScript code snippets to analyze log files in a specific format. The code snippets process log entries to perform various analyses such as counting API end points, grouping API calls by status code, and getting the total count of API calls in each minute.

Contents

Introduction

Log files often contain valuable information that can be extracted and analyzed for insights. The provided JavaScript code snippets demonstrate different log file analysis techniques using regular expressions and date manipulation.

Installation

  1. Clone this repository to your local machine:
git clone  https://github.com/kajal1309/unomok.git
  1. Navigate to the cloned directory:
cd unomok

Usage

Before running the code snippets, make sure you have Node.js installed on your machine.

  1. Open a terminal and navigate to the project directory.

  2. Run the desired code snippet using Node.js. For example, to analyze api-dev-out.log file, run the following:

node logAnalysis.ts "api-dev-out-log"

Similarly for the other two log files api-prod-out.log and prod-api-prod-out.log, we can pass the name of the log files as command line arguments

node logAnalysis.ts "api-prod-out.log"
node logAnalysis.ts "prod-api-prod-out.log"

The script will output the results to the console.

Due to size constraints, maybe the entire log file is not being uploaded in github. To overcome this issue, you can download the log files from the drive link and paste them in the project folder and then pass the name of the log file as command line argument in the above shown format.

Code Snippets

File: logAnalysis.ts

Task 1 Counting API end-points

This code snippet reads a log file, extracts timestamps, and counts the number of API end points. It uses regular expressions to match timestamps and end-points from log entries.

Task 2 Counting API Calls by Minute

This code snippet reads a log file, extracts timestamps, and calculates the total count of all API calls in each minute. It tracks the total count using an object with minute keys.

Task 3 Counting API Calls for each HTTP status code

This code snippet reads a log file, extracts timestamps, and calculates the total count of all API calls for each HTTP status code. It tracks the total count of calls for each HTTP Status code.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.