jlq

Crates.iojlq
lib.rsjlq
version0.1.0
sourcesrc
created_at2023-01-03 20:12:17.092899
updated_at2023-01-03 20:12:17.092899
descriptionQuery JSON log files quickly and efficiently with the power of SQLite
homepagehttps://github.com/hamin/jlq
repository
max_upload_size
id750387
size24,550,315
Haris Amin (hamin)

documentation

README

jlq


License: MIT

Query JSON log files quickly and efficiently with the power of SQLite

jlq

📜 Core philosophy

  • 📦 Stay lightweight
  • 🎮 Keep its features as simple as possible
  • 🧠 Use SQL to filter JSON log files
  • 💡 Use the SQLite's powerful JSON query functions+operators!
  • 🛢 Keep queried logs in a nice portable SQLite file
  • ⚡️ Tail JSON log files based on your query predicates
  • 🦾 Run SQLite in-memory for faster processing

⚠️ Non-goal

This tool doesn't have any plans to cover jq or any other query syntax othen than provided out of the box from SQLite.

🚀 Installation

Cargo

cargo install jlq

🛠️ Usage

It might help to first take a look at the options avaiable via jql -h

Command Line Options

jlq 0.1.0

USAGE:
    jlq [FLAGS] [OPTIONS] [FILE]...

FLAGS:
    -d, --debug                Activate debug mode
    -h, --help                 Prints help information
    -m, --in-memory-storage    Run SQLite in-memory mode
    -t, --tail
    -V, --version              Prints version information
    -v, --verbose              Verbose mode (-v, -vv, -vvv, etc.)

OPTIONS:
    -q, --query <query>    SQLite json query e.g. "log_line->>'level_name' = 'DEBUG'"

ARGS:
    <FILE>...    Files to process

NOTE: When running jlq with SQLite on-disk mode (the default), a SQLite file named jql.db is created from the directory where the command was run.

Import log file(s) to SQLite as is with an optional query

jlq -q "log_line->>'status_code' IN (200, 400)" log_a.json log_b.json

Tail log file(s) with on-disk SQLite file

jlq -t -q "log_line->>'status_code' IN (200, 400)" log_a.json log_b.json

Tail log file(s) with SQLite running in-memory

jlq -t -m -q "log_line->>'status_code' IN (200, 400)" log_a.json log_b.json

Contributing

PRs are welcome!

License

This project is licensed under the MIT license

Show your support

Leave a ⭐ if you like this project


Made with 💖 using SQLite 🛢 and Rust 🦀

Commit count: 0

cargo fmt