Giter VIP home page Giter VIP logo

mongo-ftdc's Introduction

Hatchet - MongoDB JSON Log Analyzer and Viewer

Hatchet is a powerful and sophisticated logs analyzer and viewer specifically designed for MongoDB JSON logs. It provides advanced features for logs processing, aggregation and storage of the processed data. To make the data accessible and usable for its users, Hatchet utilizes an embedded SQLite3 database. This database allows for the storage of processed and aggregated data and makes it possible to offer RESTful APIs and a web interface to users.

The web interface of Hatchet is highly interactive and user-friendly, providing a seamless experience for searching logs and navigating through reports and charts. The intuitive design and easy-to-use interface makes it simple for users to find what they need, when they need it. Additionally, with the embedded database, Hatchet provides fast access to data and a high level of performance, making it the ideal solution for logs analysis and management. Further design details can be found at Hatchet: Empowering Smart MongoDB Log Analysis.

Change Log

Build

Clone and run the build.sh script; gcc is required to support CGO.

git clone --depth 1 https://github.com/simagix/hatchet.git
cd hatchet ; ./build.sh

An executable hatchet is output to the directory dist/. Note that the script also works and tested on Windows x64 using MingGW and Git Bash.

Quick Start

Use the command below to process a log file, mongod.log.gz and start a web server listening to port 3721. The default database is SQLite3.

./dist/hatchet -web logs/sample-mongod.log.gz

Load a file within a defined time range:

./dist/hatchet -web -from "2023-09-23T20:25:00" -to "2023-09-23T20:26:00" logs/sample-mongod.log.gz

Load multiple files and process them individually:

./dist/hatchet -web rs1/mongod.log rs2/mongod.log rs3/mongod.log

Load multiple files and process them collectively:

./dist/hatchet -web -merge rs1/mongod.log rs2/mongod.log rs3/mongod.log

Use the URL http://localhost:3721/ in a browser to view reports and charts. Alternatively, you can use the in-memory mode without persisting data, for example:

./dist/hatchet -url in-memory logs/sample-mongod.log.gz

if you choose to view in the legacy format without a browser, use the command below:

./dist/hatchet -legacy logs/sample-mongod.log.gz

For additional usages and integration details, see developer's guide.

A Smart Log Analyzer

How smart Hatchet is? A picture is worth a thousand words.

Sage Says

Other Usages

Other than its ability to read from files, Hatchet offers additional functionality that includes reading from S3 and web servers, as well as MongoDB Atlas. This means that users can use Hatchet to conveniently access and download data from these sources, providing a more versatile and efficient data analysis experience.

Web Servers

The tool supports reading from web servers using both the http:// and https:// protocols. The -user flag is optional when using basic authentication.

hatchet [-user {username}:{password}] https://{hostname}/{log name}

Atlas

To download logs directly from MongoDB Atlas, you will need to use the -user and -digest flags and provide the necessary information for both. These flags are used to authenticate and authorize your access to the database.

hatchet -user {pub key}:{private key} -digest https://cloud.mongodb.com/api/atlas/v1.0/groups/{group ID}/clusters/{hostname}/logs/mongodb.gz

AWS S3

Hatchet has the ability to download files from AWS S3. When downloading files, Hatchet will automatically retrieve the Region and Credentials information from the configuration files located at ${HOME}/.aws. This means that there's no need to provide this information manually each time you download files from AWS S3 using Hatchet.

hatchet -s3 [--endpoint-url {test endpoint}] {bucket}/{key name}

Logs Obfuscation

Use Hatchet to obfuscate logs. It automatically obfuscates the values of the matched patterns under the "attr" field, such as SSN, credit card numbers, phone numbers, email addresses, IP addresses, FQDNs, port numbers, namespaces, and other numbers. Note that, for example, replacing "host.example.com" with "rose.taipei.com" in the log file will consistently replace all other occurrences of "host.example.com" with "rose.taipei.com". To obfuscate logs and redirect them to a file, use the following syntax:

hatchet -obfuscate {log file} > {output file}

License

Apache-2.0 License

mongo-ftdc's People

Contributors

simagix avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

mongo-ftdc's Issues

possible bug | build.sh Exec format error

when I run ./build.sh, I get Exec format error.
See the complete output:

$ ./build.sh 
go: downloading github.com/simagix/keyhole v1.0.1
go: downloading github.com/simagix/gox v0.2.0
go: downloading golang.org/x/text v0.3.3
go: downloading go.mongodb.org/mongo-driver v1.4.2
go: downloading github.com/go-stack/stack v1.8.0
./build.sh: line 11: dist/mftdc: cannot execute binary file: Exec format error

the error occurs in the 11th line: dist/mftdc -version

Useful info
build.sh content:

#! /bin/bash
# Copyright 2019 Kuei-chun Chen. All rights reserved.
die() { echo "$*" 1>&2 ; exit 1; }
REPO=$(basename "$(dirname "$(pwd)")")/$(basename "$(pwd)")
VERSION="v$(cat version)-$(date "+%Y%m%d")"
LDFLAGS="-X main.version=$VERSION -X main.repo=$REPO"
[[ "$(which go)" = "" ]] && die "go command not found"

mkdir -p dist
env CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags "$LDFLAGS" -o dist/mftdc simple_json.go
dist/mftdc -version

golang version:
go version go1.17.5 linux/amd64

Operating system info:

Distributor ID:	Linuxmint
Description:	Linux Mint 20.1
Release:	20.1
Codename:	ulyssa

How to access other metrics then presented in Grafana

Great work and tool !

But I have question regarding metrics structure, or naming conventions. Is it possible to access some other diagnostics data than those already presended in Grafana dashboard ?

I'm looking for metrics like tcmalloc statistics, as defined in

db.serverStatus().tcmalloc
{
    "generic" : {
        "current_allocated_bytes" : NumberLong("2545084352"),
        "heap_size" : NumberLong("2687029248")
    },
    "tcmalloc" : {
        "pageheap_free_bytes" : 34529280,
        "pageheap_unmapped_bytes" : 21135360,
        "max_total_thread_cache_bytes" : NumberLong(1073741824),
        "current_total_thread_cache_bytes" : 1057800,
        "total_free_bytes" : 86280256,
        "central_cache_free_bytes" : 84363448,
        "transfer_cache_free_bytes" : 859008,
        "thread_cache_free_bytes" : 1057800,
        "aggressive_memory_decommit" : 0,
        ...
    }
}

but didn´t found the way how to do it. I tried to add new chart in Grafana and put the "current_total_thread_cache_bytes" to Query, but this does not return any value.

So I´m not sure, if you publish only the limited set of attributes, or if your solution is generic and some other attributes are also accessible and I only used the bad name, because I don't know the Naming convention or any documentation, where to lookup what could be used in queries.

Please could you give some brief info how to query the other statistics ?

Currently I need to find, why my mongoDB was killed by Linux OOM killer, the MongoDB process allocates up to 128GB for process, but the WiredTiger Cache was pretty flat on 62GB of RAM. May be it is somewhere on Threads, or some other buffers, I don´t know and want to investigate other metrics provided by MongoDB in FTDC diagnostics data.

Thank you for your help, I'm sure, taht this kind of information will be werz usable for others a could improve and contribute to some new kind of dashboards in your greate project.

Bad Gateway error from Grafana panels

Once logged into Grafana and having both containers running, "mongo-ftdc_ftdc_1" and "mongo-ftdc_grafana-ftdc_1", the requested for the grafana panels on the "MongoDB FTDC Analytics" dashboard are returning "Bad Gateway".

handling metrics from multiple host

mongo-ftdc expects metrics data of one host in /diagnostic.data. Is there a way to supply multiple metrics from different hosts. and some how filter them in grafana by host name. Creating on subdirectory per host did not work. putting them all in ./diagnostic.data with a host name at the end of filename works but only files from one node are parsed. (ignoring the rest).

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.