Fblog

Small command-line JSON Log viewer
Alternatives To Fblog
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
30 Days Of Javascript38,494
3 days ago1January 19, 2022325JavaScript
30 days of JavaScript programming challenge is a step-by-step guide to learn JavaScript programming language in 30 days. This challenge may take more than 100 days, please just follow your own pace. These videos may help too: https://www.youtube.com/channel/UC7PNRuno1rzYPb1xLa4yktw
Cli29,278
24 days ago157bsd-3-clausePython
🥧 HTTPie CLI — modern, user-friendly command-line HTTP client for the API era. JSON support, colors, sessions, downloads, plugins & more.
Cli20,7274,8719 days ago163June 14, 202346mitGo
A simple, fast, and fun package for building command line apps in Go
Fx17,3501120a day ago52May 08, 20233mitGo
Terminal JSON viewer & processor
Yq9,381704 days ago126July 12, 2023100mitGo
yq is a portable command-line YAML, JSON, XML, CSV, TOML and properties processor
Fq8,876
3 days ago104July 07, 202346otherGo
jq for binary formats - tool, language and decoders for working with binary and text formats
Http Prompt8,762715 months ago24March 05, 202153mitPython
An interactive command-line HTTP and API testing client built on top of HTTPie featuring autocomplete, syntax highlighting, and more. https://twitter.com/httpie
Miller8,104
7 days ago65November 26, 202297otherGo
Miller is like awk, sed, cut, join, and sort for name-indexed data such as CSV, TSV, and tabular JSON
Visidata6,807577 days ago52July 17, 202389gpl-3.0Python
A terminal spreadsheet multitool for discovering and arranging data
Structured Text Tools6,743
17 days ago3
A list of command line tools for manipulating structured text data
Alternatives To Fblog
Select To Compare


Alternative Project Comparisons
Readme

./logo/fblog_small.png

fblog

https://img.shields.io/crates/v/fblog.svg https://github.com/brocode/fblog/actions/workflows/rust.yml/badge.svg?branch=master https://img.shields.io/discord/730728064031653999.svg

A small tool to view json log files.

demo.png

Print specific fields

fblog -a message -a "status > a" sample_nested.json.log

Prefix Logs

If your query docker or kubectl for multiple pods it will prefix the log lines: PODNAME | {"message": "test"}. fblog can parse this and add it to the message. Just use -p.

Filter

To filter log messages it is possible to use lua. If you are unsure which variables are available you can use --print-lua to see the code generated by fblog.

fblog -f 'level ~= "info"' # will print all message where the level is not info
fblog -f 'process == "play"' # will print all message where the process is play
fblog -f 'string.find(fu, "bow.*") ~= nil' # will print all messages where fu starts with bow
fblog -f 'process == "play"' # will print all message where the process is play
fblog -f 'process == "rust" and fu == "bower"'
fblog --no-implicit-filter-return-statement -f 'if 3 > 2 then return true else return false end'

# not valid lua identifiers like log.level gets converted to log_level.
# Every character that is not _ or a letter will be converted to _
fblog -d -f 'log_level == "WARN"' sample_elastic.log

# nested fields are converted to lua records
fblog  -d -f 'status.a == 100' sample_nested.json.log

# array fields are converted to lua tables (index starts with 1)
fblog  -d -f 'status.d[2] == "a"' sample_nested.json.log

Customize

fblog tries to detect the message, severity and timestamp of a log entry. This behavior can be customized. See --help for more information.

You can customize fblog messages: Format output:

fblog -p --main-line-format "{{#if short_message}}{{ red short_message }}{{/if}}" sample.json.log

The following sanitized variables are provided by fblog:

  • fblog_timestamp
  • fblog_level
  • fblog_message
  • fblog_prefix

For the default formatting see --help

Nested values are registered as objects. So you can use nested.value to access nested values.

handlebar helpers:

  • bold
  • yellow
  • red
  • blue
  • purple
  • green
  • color_rgb 0 0 0
  • uppercase
  • level_style
  • fixed_size 10

NO_COLOR

fblog disables color output if the NO_COLOR environment variable is present.

no-color

Message placeholder substitution

Placeholders in the message (fblog_message) can be substituted with their corresponding values in a context object or array. To enable substitutions, pass the -s flag or either set context key (-c context) or placeholder format (-F {key}).

Note that the placeholder format should be written like <PREFIX>key<SUFFIX>, where it would match a placeholder with the key key.

Example

Given the following log (referred to as example.log):

{"message": "Found #{count} new items.", "extra_data": {"count": 556}, "level": "info"}

Running with the following arguments:

fblog -c extra_data -F '#{key}' example.log

Result:

./res/placeholder-example1.svg

Installation

cargo install fblog

Available in package managers: AUR, brew

Log tailing

fblog does not support native log tailing but this is easily achiveable.

tail -f file | fblog

Or with kubernetes tooling for example

kubectl logs -f ... | fblog

In general you can pipe any endless stream to fblog.

Discord

In the case you want to talk about new features or give us direct feedback, you can join the Discord (Thanks @rawkode) in the channel #fblog.

Popular Json Projects
Popular Command Line Projects
Popular Data Formats Categories
Related Searches

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
Command Line
Rust
Json
Play Framework
Command Line Tool