-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs: Add user docs for opening log files, level filtering, and formatting structured logs. #132
Changes from 1 commit
bb5617a
28067b6
637b520
a3d053b
941b558
60aade6
8d7d10a
59f3e22
42e1f43
fd19fa2
c2e92cf
fbd51cd
e18af3c
68ab84e
6ca3093
163d2c6
2c9d621
2e774dc
a0742a6
893820e
04442ef
2efe385
e60e376
32605d2
7d56440
6c0359b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we use the |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Formatters | ||
|
||
Formatters allow you to transform how field values are displayed. See below for a list of | ||
formatters. | ||
|
||
## Timestamp Formatter | ||
|
||
Converts Unix timestamps to human-readable date-time strings. | ||
|
||
**Usage:** | ||
`{field:timestamp[:options]}` | ||
|
||
**Options:** | ||
- Accepts a format string specifically for the date. | ||
- Uses [Day.js format tokens](https://day.js.org/docs/en/display/format). | ||
- Date string must escape colons with a backslash, e.g., `HH\:mm\:ss`. | ||
- If no format is specified, the default format is ISO 8601. | ||
|
||
**Examples:** | ||
- `{ts:timestamp}` → `2024-11-27T10:30:00Z` | ||
- `{ts:timestamp:YYYY-MM-DD}` → `2024-11-27` | ||
|
||
--- | ||
|
||
## Round Formatter | ||
|
||
Rounds a numeric value to the nearest integer. | ||
|
||
**Usage:** | ||
`{field:round}` | ||
|
||
**Example:** | ||
- `{value:round}` → `5.7` becomes `6` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Overview | ||
|
||
The log viewer can accept a format string to transform JSON logs into human-readable text. | ||
You can select which fields to display and how they should be formatted. The format string | ||
input can be found in the settings dialog. | ||
|
||
For example, for a JSON log with many fields: | ||
|
||
```json | ||
{ | ||
"ts": 1732733160216, | ||
"level": "ERROR", | ||
"message": "Failed to process payment transaction", | ||
"trace_id": "abc123def456", | ||
"span_id": "span_789xyz", | ||
"service": "payment-service", | ||
"environment": "production", | ||
} | ||
``` | ||
|
||
You might want to show only: | ||
- timestamp | ||
- log level | ||
- message | ||
|
||
You can achieve this with the following format string `{ts:timestamp} {level} {message}`. | ||
`{ts:timestamp}` formats the timestamp field (Unix epoch) into a ISO 8601 date format. | ||
`{level}` and `{message}` display the field as is. | ||
|
||
The log is displayed as: | ||
``` | ||
2024-11-27T18:46:00Z ERROR Failed to process payment transaction. | ||
``` | ||
|
||
For detailed information about the format string syntax, see [Format String Syntax](format-string-syntax). |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# Format String Syntax | ||
|
||
- The format string is composed of arbitrary (“static”) text and field placeholders enclosed in | ||
braces (`{` and `}`). | ||
- Each brace or backslash in the static text must be escaped by a backslash. | ||
- Each field placeholder has the following form, consisting of three components (contained in | ||
braces): | ||
|
||
``` | ||
{<field-name>[:<formatter-name>[:<formatter-options>]]} | ||
``` | ||
|
||
- `field-name` (required) defines the key of the field whose value should replace the | ||
placeholder. | ||
- Nested fields can be specified using periods (`.`) to denote hierarchy. E.g., the field | ||
`{"a:" {"b": 0}}` may be denoted by `a.b`. | ||
- Field names can contain any character except that each period, dollar sign, brace (left | ||
or right), colon, or backslash must be escaped with a backslash. | ||
- `formatter-name` (optional, unless `formatter-options` is specified) is the name of the | ||
formatter to apply to the value before inserting it into the string. | ||
- Formatter names can contain any character except a space (’ ‘) while each brace (left or | ||
right), colon, or backslash must be escaped with a backslash. | ||
- `formatter-options` (optional) defines any options for the formatter denoted by | ||
`formatter-name`. | ||
- Formatter options can contain any character except each brace (left or right), colon, or | ||
backslash must be escaped with a backslash. | ||
- Finally, every format string contains an implicit trailing newline so that each formatted log | ||
event ends with a newline. | ||
|
||
For example, consider the following log event: | ||
|
||
``` | ||
{ | ||
"@timestamp": 1427153388942, | ||
"level": "INFO", | ||
"thread": 0, | ||
"latency_secs": 56.4, | ||
"an.odd.key{name}": "org.apache.hadoop.metrics2.impl.MetricsConfig: loaded properties from | ||
hadoop-metrics2.properties" | ||
} | ||
``` | ||
|
||
We can format this using the following YScope format string: | ||
|
||
``` | ||
{@timestamp:timestamp:YYYY-MM-DD HH\:MM\:ss.SSS} {level} \{{thread}\} latency={latency_secs:round} | ||
{an\.odd\.key\{name\}} | ||
``` | ||
|
||
- In the first placeholder, we have the field name `ts`, a formatter called `timestamp`, and the | ||
formatter’s options which are a date format string. | ||
- The second and third placeholders simply stringify the values of the given fields. | ||
- The fourth placeholder uses the `round` formatter to round the field’s value; this placeholder | ||
doesn’t specify any formatter options, so the defaults will be used. | ||
- The fifth placeholder is for a field whose name contains characters that require escaping. | ||
|
||
The formatted string will be: | ||
|
||
``` | ||
2015-03-23 19:29:48.942 INFO {0} latency=56 org.apache.hadoop.metrics2.impl.MetricsConfig: loaded | ||
properties from hadoop-metrics2.properties | ||
``` | ||
|
||
For a list of currently supported formatters, see [Formatters](format-string-formatters). |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we rename to |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Overview | ||
|
||
The log viewer offers two ways to filter log levels. | ||
|
||
## Severity Filtering | ||
Filter logs at or above a selected level. Click the level name (e.g., INFO) to show all logs at | ||
or above that severity. For example, selecting INFO shows INFO, WARN, ERROR, and FATAL logs. | ||
|
||
![Severity filtering](../attachments/severity-filter.png) | ||
|
||
## Individual Filtering | ||
Select specific log levels to show or hide. Use the checkboxes next to each level name to toggle | ||
visibility. | ||
|
||
![Individual level filtering](../attachments/individual-filter.png) |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we drop |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Overview | ||
|
||
This guide shows you how to open local and remote log files. | ||
|
||
## Local Files | ||
To open a local file, use the folder icon (📁) in the top-left corner. This will open a file | ||
browser where you can navigate to and select your log file. | ||
|
||
## Remote Files | ||
To open a remote file, append `/?filePath=<FILE_URL>` to the current URL. Just replace | ||
`<FILE_URL>` with the URL of your log file. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
user-guide
)?docs/src
like we do in CLP?