Skip to content

Commit e4816e4

Browse files
authored
docs: simplify Readme.md (#114)
1 parent ff7a3b7 commit e4816e4

File tree

7 files changed

+159
-152
lines changed

7 files changed

+159
-152
lines changed

README.md

Lines changed: 13 additions & 152 deletions
Original file line numberDiff line numberDiff line change
@@ -5,167 +5,28 @@
55
[![Go Report Card](https://goreportcard.com/badge/github.com/hedhyw/json-log-viewer)](https://goreportcard.com/report/github.com/hedhyw/json-log-viewer)
66
[![Coverage Status](https://coveralls.io/repos/github/hedhyw/json-log-viewer/badge.svg?branch=main)](https://coveralls.io/github/hedhyw/json-log-viewer?branch=main)
77

8-
It is an **interactive** tool for viewing and analyzing complex structured [json-log](assets/example.log) files.
8+
An interactive tool for viewing and analyzing complex structured JSON logs.
99

1010
![Animation](./assets/animation.webp)
1111

12-
Main features:
13-
1. It is interactive.
14-
2. It displays a compact list of log entries.
15-
3. It is possible to expand the log and see the full prettified JSON tree.
16-
4. All non-json logs are captured.
17-
5. Fields are [customizable](#customization).
18-
6. Filtering is easy to use.
19-
7. Log levels are colorized.
20-
8. Transforming numeric timestamps.
12+
## Installation
2113

22-
It uses [antonmedv/fx](https://github.com/antonmedv/fx) for viewing JSON records and [charmbracelet/bubbletea](https://github.com/charmbracelet/bubbletea) for organizing the terminal UI. The tool is inspired by the project [json-log-viewer](https://github.com/gistia/json-log-viewer) which is unfortunately outdated and deserted.
23-
24-
The application is designed to help in visualization, navigation, and analyzing of JSON-formatted log data in a user-friendly and interactive manner. It provides a structured and organized view of the JSON logs, making it easier to comprehend the hierarchical nature of the data. It uses collapsible/expandable tree structures, indentation, and color-coded syntax to represent the JSON objects and arrays. It is possible to search for specific keywords, phrases, or patterns within the JSON logs. So it helps to significantly simplify the process of working with JSON logs, making it more intuitive and efficient. It is easy to troubleshoot issues, monitor system performance, or gain a deeper understanding of the application's behavior by analyzing its log data in post-mortem.
25-
26-
## Table of content
27-
28-
- [JSON Log Viewer](#json-log-viewer)
29-
- [Table of content](#table-of-content)
30-
- [Usage](#usage)
31-
- [Reading from file](#reading-from-file)
32-
- [Reading from Stdin](#reading-from-stdin)
33-
- [Hotkeys](#hotkeys)
34-
- [Install](#install)
35-
- [MacOS/Linux HomeBrew](#macoslinux-homebrew)
36-
- [Package](#package)
37-
- [Standalone Binary](#standalone-binary)
38-
- [Source](#source)
39-
- [Customization](#customization)
40-
- [Time Formats](#time-formats)
41-
- [`time`](#time)
42-
- [`numerictime`](#numerictime)
43-
- [`secondtime`](#secondtime)
44-
- [`millitime`](#millitime)
45-
- [`microtime`](#microtime)
46-
- [Resources](#resources)
47-
- [Contribution](#contribution)
48-
- [License](#license)
49-
50-
## Usage
51-
52-
### Reading from file
53-
```shell
54-
jlv assets/example.log
55-
jlv -config example.jlv.jsonc assets/example.log
56-
```
57-
58-
### Reading from Stdin
59-
60-
```shell
61-
jlv < assets/example.log
62-
```
63-
64-
Common applications:
14+
### Homebrew
6515

6616
```shell
67-
curl https://raw.githubusercontent.com/hedhyw/json-log-viewer/main/assets/example.log | jlv
68-
69-
jlv << EOF
70-
{"time":"1970-01-01T00:00:00.00","level":"INFO","message": "day 1"}
71-
{"time":"1970-01-02T00:00:00.00","level":"INFO","message": "day 2"}
72-
EOF
73-
74-
kubectl logs pod/POD_NAME -f | jlv
75-
docker logs -f 000000000000 2>&1 | jlv
76-
```
77-
78-
### Hotkeys
79-
80-
| Key | Action |
81-
|--------|-------------------|
82-
| Enter | Open log |
83-
| Esc | Back |
84-
| F | Filter |
85-
| R | Reverse |
86-
| Ctrl+C | Exit |
87-
| F10 | Exit |
88-
| ↑↓ | Line Up / Down |
89-
| Home | Navigate to Start |
90-
| End | Navigate to End |
91-
92-
> Attempting to navigate past the last line in the log will put you in follow mode.
93-
94-
## Install
95-
96-
### MacOS/Linux HomeBrew
97-
98-
```sh
9917
brew install hedhyw/main/jlv
100-
# jlv application.log
101-
```
102-
103-
### Package
104-
105-
Latest DEB and RPM packages are available on [the releases page](https://github.com/hedhyw/json-log-viewer/releases/latest).
106-
107-
### Standalone Binary
108-
109-
Download latest archive `*.tar.gz` for your target platform from [the releases page](https://github.com/hedhyw/json-log-viewer/releases/latest) and extract it to `/usr/local/bin/jlv`. Add this path to `PATH` environment.
110-
111-
### Source
112-
113-
```sh
114-
git clone [email protected]:hedhyw/json-log-viewer.git
115-
cd json-log-viewer
116-
make build
117-
cp ./bin/jlv /usr/local/bin
118-
chmod +x /usr/local/bin/jlv
119-
120-
# jlv application.log
12118
```
12219

123-
## Customization
124-
125-
The application will look for the config `.jlv.jsonc` in the working directory or in the home directory:
126-
- `$PWD/.jlv.jsonc`;
127-
- `$HOME/.jlv.jsonc`.
128-
129-
It's also possible to define the path to the configuration using "-config" flag.
130-
131-
The Json path supports the described in [yalp/jsonpath](https://github.com/yalp/jsonpath#jsonpath-quick-intro) syntax.
132-
133-
Example configuration: [example.jlv.jsonc](example.jlv.jsonc).
134-
135-
### Time Formats
136-
JSON Log Viewer can handle a variety of datetime formats when parsing your logs.
137-
The value is formatted by default in the "[RFC3339](https://www.rfc-editor.org/rfc/rfc3339)" format. The format is configurable, see the `time_format` field in the [config](example.jlv.jsonc).
138-
139-
#### `time`
140-
This will return the exact value that was set in the JSON document.
141-
142-
#### `numerictime`
143-
This is a "smart" parser. It can accept an integer, a float, or a string. If it is numeric (`1234443`, `1234443.589`, `"1234443"`, `"1234443.589"`), based on the number of digits, it will parse as seconds, milliseconds, or microseconds. The output is a UTC-based RFC 3339 datetime.
144-
145-
If a string such as `"2023-05-01T12:00:34Z"` or `"---"` is used, the value will just be carried forward to your column.
146-
147-
If you find that the smart parsing is giving unwanted results or you need greater control over how a datetime is parsed, considered using one of the other time formats instead.
148-
149-
#### `secondtime`
150-
This will attempt to parse the value as number of seconds and render as a UTC-based RFC 3339. Values accepted are integer, string, or float.
151-
152-
#### `millitime`
153-
Similar to `secondtime`, this will attempt to parse the value as number of milliseconds. Values accepted are integer, string, or float.
154-
155-
#### `microtime`
156-
Similar to `secondtime` and `millistime`, this will attempt to parse the value as number of microseconds. Values accepted are integer, string, or float.
157-
158-
## Resources
159-
160-
Alternatives:
161-
- [mightyguava/jl](https://github.com/mightyguava/jl) - Pretty Viewer for JSON logs.
162-
- [pamburus/hl](https://github.com/pamburus/hl) - A log viewer that translates JSON logs into human-readable representation.
163-
- [json-log-viewer](https://github.com/gistia/json-log-viewer) - Powerful terminal based viewer for JSON logs using ncurses.
164-
165-
## Contribution
20+
### Standalone Binary, DEB or RPM packages
16621

167-
Check [open unassigned issues](https://github.com/hedhyw/json-log-viewer/issues), write comments, ask questions, fork, and create a pull request.
22+
https://github.com/hedhyw/json-log-viewer/releases/latest
16823

169-
## License
24+
## Documentation
17025

171-
[MIT License](LICENSE).
26+
- [Features](docs/features.md).
27+
- [Install from source](docs/install-from-source.md).
28+
- [Usage](docs/usage.md).
29+
- [Customization](docs/customization.md).
30+
- [Resources](docs/resources.md).
31+
- [Contribution](docs/CONTRIBUTING).
32+
- [MIT License](LICENSE).

docs/CONTRIBUTING

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
# Contribution
3+
4+
- Check [open unassigned issues](https://github.com/hedhyw/json-log-viewer/issues);
5+
- Write comments;
6+
- Ask questions;
7+
- Fork;
8+
- Create a PR with your changes.
9+
10+
Thank you!

docs/customization.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Customization
2+
3+
The application will look for the config `.jlv.jsonc` in the working directory or in the home directory:
4+
- `$PWD/.jlv.jsonc`;
5+
- `$HOME/.jlv.jsonc`.
6+
7+
It's also possible to define the path to the configuration using "-config" flag.
8+
9+
The Json path supports the described in [yalp/jsonpath](https://github.com/yalp/jsonpath#jsonpath-quick-intro) syntax.
10+
11+
Example configuration: [example.jlv.jsonc](../example.jlv.jsonc).
12+
13+
## Time Formats
14+
JSON Log Viewer can handle a variety of datetime formats when parsing your logs.
15+
The value is formatted by default in the "[RFC3339](https://www.rfc-editor.org/rfc/rfc3339)" format. The format is configurable, see the `time_format` field in the [config](../example.jlv.jsonc).
16+
17+
### `time`
18+
This will return the exact value that was set in the JSON document.
19+
20+
### `numerictime`
21+
This is a "smart" parser. It can accept an integer, a float, or a string. If it is numeric (`1234443`, `1234443.589`, `"1234443"`, `"1234443.589"`), based on the number of digits, it will parse as seconds, milliseconds, or microseconds. The output is a UTC-based RFC 3339 datetime.
22+
23+
If a string such as `"2023-05-01T12:00:34Z"` or `"---"` is used, the value will just be carried forward to your column.
24+
25+
If you find that the smart parsing is giving unwanted results or you need greater control over how a datetime is parsed, considered using one of the other time formats instead.
26+
27+
### `secondtime`
28+
This will attempt to parse the value as number of seconds and render as a UTC-based RFC 3339. Values accepted are integer, string, or float.
29+
30+
### `millitime`
31+
Similar to `secondtime`, this will attempt to parse the value as number of milliseconds. Values accepted are integer, string, or float.
32+
33+
### `microtime`
34+
Similar to `secondtime` and `millistime`, this will attempt to parse the value as number of microseconds. Values accepted are integer, string, or float.

docs/features.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Features
2+
3+
It is an **interactive** tool for viewing and analyzing complex structured [json-log](../assets/example.log) files.
4+
5+
Main features:
6+
1. It is interactive.
7+
2. It displays a compact list of log entries.
8+
3. It is possible to expand the log and see the full prettified JSON tree.
9+
4. All non-json logs are captured.
10+
5. Fields are [customizable](./customization.md).
11+
6. Filtering is easy to use.
12+
7. Log levels are colorized.
13+
8. Transforming numeric timestamps.
14+
15+
It uses [antonmedv/fx](https://github.com/antonmedv/fx) for viewing JSON records and [charmbracelet/bubbletea](https://github.com/charmbracelet/bubbletea) for organizing the terminal UI. The tool is inspired by the project [json-log-viewer](https://github.com/gistia/json-log-viewer) which is unfortunately outdated and deserted.
16+
17+
The application is designed to help in visualization, navigation, and analyzing of JSON-formatted log data in a user-friendly and interactive manner. It provides a structured and organized view of the JSON logs, making it easier to comprehend the hierarchical nature of the data. It uses collapsible/expandable tree structures, indentation, and color-coded syntax to represent the JSON objects and arrays. It is possible to search for specific keywords, phrases, or patterns within the JSON logs. So it helps to significantly simplify the process of working with JSON logs, making it more intuitive and efficient. It is easy to troubleshoot issues, monitor system performance, or gain a deeper understanding of the application's behavior by analyzing its log data in post-mortem.

docs/install-from-source.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Install from source
2+
3+
## Requirements
4+
- `git`;
5+
- `make`;
6+
- `go` 1.23+.
7+
8+
## Run
9+
10+
Get the source code:
11+
```shell
12+
git clone [email protected]:hedhyw/json-log-viewer.git && cd json-log-viewer
13+
```
14+
15+
Compile:
16+
```shell
17+
make build
18+
```
19+
20+
Install:
21+
```shell
22+
cp ./bin/jlv /usr/local/bin
23+
chmod +x /usr/local/bin/jlv
24+
```
25+
26+
Use as [jlv](usage.md).

docs/resources.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
## Resources
2+
3+
Alternative applications:
4+
- [mightyguava/jl](https://github.com/mightyguava/jl) - Pretty Viewer for JSON logs.
5+
- [pamburus/hl](https://github.com/pamburus/hl) - A log viewer that translates JSON logs into human-readable representation.
6+
- [json-log-viewer](https://github.com/gistia/json-log-viewer) - Powerful terminal based viewer for JSON logs using ncurses.

docs/usage.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Advanced usage
2+
3+
## Hotkeys
4+
5+
| Key | Action |
6+
|--------|-------------------|
7+
| Enter | Open log |
8+
| Esc | Back |
9+
| F | Filter |
10+
| R | Reverse |
11+
| Ctrl+C | Exit |
12+
| F10 | Exit |
13+
| ↑↓ | Line Up / Down |
14+
| Home | Navigate to Start |
15+
| End | Navigate to End |
16+
| ? | Show/Hide help |
17+
18+
> Attempting to navigate past the last line in the log will put you in follow mode.
19+
20+
## Configuration
21+
22+
```shell
23+
jlv -config example.jlv.jsonc assets/example.log
24+
jlv -config example.jlv.jsonc < assets/example.log
25+
```
26+
27+
## Pull logs by URL
28+
29+
```shell
30+
URL="https://raw.githubusercontent.com/hedhyw/json-log-viewer/main/assets/example.log"
31+
curl "$URL" | jlv
32+
```
33+
34+
## Preview logs from string
35+
36+
```shell
37+
jlv << EOF
38+
{"time":"1970-01-01T00:00:00.00","level":"INFO","message": "day 1"}
39+
{"time":"1970-01-02T00:00:00.00","level":"INFO","message": "day 2"}
40+
EOF
41+
```
42+
43+
## Show kubernetes logs
44+
45+
```shell
46+
kubectl logs pod/POD_NAME -f | jlv
47+
```
48+
49+
## View docker logs
50+
51+
```shell
52+
docker logs -f 000000000000 2>&1 | jlv
53+
```

0 commit comments

Comments
 (0)