diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 20:01:36 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 20:01:36 +0000 |
commit | 62e4c68907d8d33709c2c1f92a161dff00b3d5f2 (patch) | |
tree | adbbaf3acf88ea08f6eeec4b75ee98ad3b07fbdc /docs/_posts | |
parent | Initial commit. (diff) | |
download | lnav-62e4c68907d8d33709c2c1f92a161dff00b3d5f2.tar.xz lnav-62e4c68907d8d33709c2c1f92a161dff00b3d5f2.zip |
Adding upstream version 0.11.2.upstream/0.11.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'docs/_posts')
22 files changed, 612 insertions, 0 deletions
diff --git a/docs/_posts/2013-09-10-json-encoded-logs.md b/docs/_posts/2013-09-10-json-encoded-logs.md new file mode 100644 index 0000000..1fa36a4 --- /dev/null +++ b/docs/_posts/2013-09-10-json-encoded-logs.md @@ -0,0 +1,56 @@ +--- +layout: post +title: "Support for JSON-encoded logs in v0.6.1" +date: 2013-09-10 00:00:00 +excerpt: Turning JSON barf into something readable. +--- + +Making logs easily digestible by machines is becoming a concern as tools like +elasticsearch become more popular. One of the popular strategies is to encode +the whole log message in JSON and then write that as a single line to a file. +For example: + +```json +{"time": "2013-09-04T23:55:09.274041Z", "level" : "INFO", "body" : "Hello, World!" } +{"time": "2013-09-04T23:56:00.285224Z", "level" : "ERROR", "body" : "Something terrible has happened!", "tb": " foo.c:12\n bar.y:33" } +``` + +Unfortunately, what is good for a machine is not so great for a human. To try to +improve the situation, the latest release of lnav includes support for parsing +JSON log messages and transforming them on-the-fly. The display format is +specified in a log format configuration and can specify which fields should be +displayed on the main message line. Any unused fields that are found in the +message will be displayed below the main field so you don't miss anything. + +The above log lines can be transformed using the following format configuration: + +```json +{ + "json_ex_log": { + "title": "Example JSON Log", + "description": "An example log format configuration for JSON logs", + "json": true, + "file-pattern": "test-log\\.json.*", + "level-field": "level", + "line-format": [ + { + "field": "time" + }, + " ", + { + "field": "body" + } + ] + } +} +``` + +After copying this config to `~/.lnav/formats/test/format.json`, the log messages +will look like this when viewed in lnav: + +``` +2013-09-04T23:55:09.274041Z Hello, World! +2013-09-04T23:56:00.285224Z Something terrible has happened! + tb: foo.c:12 + tb: bar.y:33 +``` diff --git a/docs/_posts/2013-09-13-four-years-on-github.md b/docs/_posts/2013-09-13-four-years-on-github.md new file mode 100644 index 0000000..875dc53 --- /dev/null +++ b/docs/_posts/2013-09-13-four-years-on-github.md @@ -0,0 +1,12 @@ +--- +layout: post +title: "Four years on GitHub" +date: 2013-09-13 00:00:00 +excerpt: Still going strong! +--- + +The [first commit](https://github.com/tstack/lnav/commit/b4ec432515e95e86ec9d711833b8cb34d0912546) +to the [lnav repository](https://github.com/tstack/lnav) was four years ago +today! I started working on lnav a couple of years before that, but this was +its first public appearance. I still use it every day and plan to keep things +going for years to come. diff --git a/docs/_posts/2013-10-05-mini-review-in-linux-magazine.md b/docs/_posts/2013-10-05-mini-review-in-linux-magazine.md new file mode 100644 index 0000000..19f9c73 --- /dev/null +++ b/docs/_posts/2013-10-05-mini-review-in-linux-magazine.md @@ -0,0 +1,8 @@ +--- +layout: post +title: "Mini review of lnav in Linux Magazine" +date: 2013-10-05 00:00:00 +--- + +The [October issue of Linux Magazine](http://www.linux-magazine.com/Issues/2013/155/Tool-Tips) +has a nice review of lnav v0.5.0, the author gave it four out of five stars! diff --git a/docs/_posts/2013-10-06-competing-with-tail.md b/docs/_posts/2013-10-06-competing-with-tail.md new file mode 100644 index 0000000..b93e7bd --- /dev/null +++ b/docs/_posts/2013-10-06-competing-with-tail.md @@ -0,0 +1,23 @@ +--- +layout: post +title: "Competing with 'tail -f'" +date: 2013-09-10 00:00:00 +excerpt: The standard utilities are tough competition. +--- + +Probably the toughest competition for lnav is the standard Unix utilities like +tail, grep, less, and emacs/vim. It can be hard trying to convince people that +these built-in commands that they've used for forever can be improved upon. The +advanced features of lnav might even work against it since folks are expecting +to have to learn a bunch of stuff to see any benefits. + +The reality is that there are quite a few "passive" features in lnav that can +provide value with no effort required by the user. For example, lnav can easily +replace 'tail -f', it's even shorter to type! Beyond the basic task of +displaying new lines appended to a log file, you also get to see log messages +from multiple files interleaved, the ability to scroll backwards, syntax +highlighting, live searching, and so on. These basic features do not have the +same "wow" factor as executing a SQL query over data automatically extracted +from a log file, but they're the features that get used 90% of the time. + +Anyways, I think I'm gaining a new appreciation for marketing/sales... diff --git a/docs/_posts/2013-11-01-mini-review-linux-user-magazine.md b/docs/_posts/2013-11-01-mini-review-linux-user-magazine.md new file mode 100644 index 0000000..02d67f6 --- /dev/null +++ b/docs/_posts/2013-11-01-mini-review-linux-user-magazine.md @@ -0,0 +1,9 @@ +--- +layout: post +title: "Mini-review of lnav in Linux User Magazine" +date: 2013-09-10 00:00:00 +--- + +The german magazine, [Linux User](http://www.linux-user.de/), has a +mini-review of lnav v0.6.0 in their +[November issue](http://www.linux-user.de/Downloads/LUCE/2013/lu-ce_2013-11.pdf)! diff --git a/docs/_posts/2014-02-22-changes-to-the-scrollbar.md b/docs/_posts/2014-02-22-changes-to-the-scrollbar.md new file mode 100644 index 0000000..2c9a21f --- /dev/null +++ b/docs/_posts/2014-02-22-changes-to-the-scrollbar.md @@ -0,0 +1,21 @@ +--- +layout: post +title: "Changes To The Scrollbar" +date: 2014-02-22 00:00:00 +excerpt: Packing more information into the right scrollbar. +--- + +I've made some changes to the scrollbar that is shown on the right side of the +display based on some feedback from users. The scroll area now has a single +vertical line extending from the top to the bottom. Previously, this area would +show log message characters and it wasn't very clear that the scroll bar +existed. The line is colored based whether there are errors or warnings in that +part of the log. The coloring should make it easier to see the distribution of +errors across the whole log. Similarly, there are notches added to the left and +right side of the line to show search hits and bookmarks, respectively. See the +following screenshot to get an idea of what it looks like: + +![Screenshot of the redesigned scrollbar](/assets/images/scrollbar-change-2.png) + +These changes are currently only in the latest code from git. I'll be playing +with things a bit more before making a release. diff --git a/docs/_posts/2014-11-11-lofi-mode.md b/docs/_posts/2014-11-11-lofi-mode.md new file mode 100644 index 0000000..b6ca628 --- /dev/null +++ b/docs/_posts/2014-11-11-lofi-mode.md @@ -0,0 +1,23 @@ +--- +layout: post +title: Added "lo-fi" mode +excerpt: An alternative way to copy displayed text. +--- + +*(This change is in v0.7.2+)* + +Copying text to the clipboard can be done by marking lines with the +[bookmark hotkeys](https://docs.lnav.org/en/latest/hotkeys.html#bookmarks), +like `m`, and then pressing `c`. Commands that write to a file, +like [`:write-csv-to`](https://docs.lnav.org/en/latest/commands.html#write-csv-to-path) +accept `/dev/clipboard` as a way to write to the clipboard. However, if the +native clipboard isn't supported, or you're on an SSH connection, you can +now switch to "lo-fi" mode. In "lo-fi" mode, lnav drops out of the curses +display and prints the raw text to the terminal. You can switch to "lo-fi" +mode in a view by pressing `CTRL-L`. For commands, you can use a dash `-` +to switch to "lo-fi" and print to standard out. + +<script id="asciicast-fH4cdgugIJVcPQnSwCmTdaA7f" + src="https://asciinema.org/a/fH4cdgugIJVcPQnSwCmTdaA7f.js" + async> +</script> diff --git a/docs/_posts/2015-04-11-pretty-print-view.md b/docs/_posts/2015-04-11-pretty-print-view.md new file mode 100644 index 0000000..6ea31b1 --- /dev/null +++ b/docs/_posts/2015-04-11-pretty-print-view.md @@ -0,0 +1,39 @@ +--- +layout: post +title: "Pretty-print view in v0.7.3" +date: 2015-04-11 00:00:00 +excerpt: Automatically reformat structured data with "SHIFT+P". +--- + +I wanted to call out the pretty-print feature in the latest release of lnav. +This idea came from a coworker of Suresh who was having a hard time trying to +read some unformatted XML in a log. They wanted the XML pretty-printed and were +hoping that could be done by just piping the message to xmlpp or the like. So, +first we implemented the 'pipe-to' and 'pipe-line-to' commands that will let you +pipe log messages to a command and then display the result inside of lnav. That +worked well enough, but pretty-printing is such a frequent operation that having +to execute a command was kind of a pain. It would also be nice if it worked for +a variety of text, like JSON or Python data. The solution we came up with was to +leverage the existing code for parsing log messages to create a simple +pretty-printer that should work for most data formats. Another benefit is that +the log message does not have to be well-formed for the printer to work, any +leading or trailing garbage shouldn't confuse things. + +As an example, here is a screenshot of the log message with the unformatted XML +text with word-wrapping turned on: + +![Screenshot of raw XML](/assets/images/lnav-before-pretty.png) + +That's not very easy to read and it's hard to figure out the structure of the +message. Now, here is that same message after pressing SHIFT+P to switch to the +pretty-print view of lnav: + +![Screenshot of pretty-printed XML](/assets/images/lnav-after-pretty.png) + +The XML text is indented nicely and the usual syntax highlighting is applied. +Also notice that lnav will automatically try to lookup the DNS name for IP +addresses. Overall, I think it's a major improvement over the raw view. + +This is a pretty simple feature but I have found it quite useful in the couple +weeks that it has been implemented. It's so useful that I'm kicking myself for +not having thought of it before. diff --git a/docs/_posts/2016-03-20-lnav-in-print.md b/docs/_posts/2016-03-20-lnav-in-print.md new file mode 100644 index 0000000..73e7722 --- /dev/null +++ b/docs/_posts/2016-03-20-lnav-in-print.md @@ -0,0 +1,10 @@ +--- +layout: post +title: "lnav in print" +date: 2016-03-20 00:00:00 +--- + +A [review of lnav](https://archive.org/details/Linux_User_Developer_162_2016_UK/page/n87/mode/2up) +is in Linux User & Developer magazine issue 162: + +![Picture of lnav story in the magazine](/assets/images/linux-user-and-dev-mag.jpeg) diff --git a/docs/_posts/2018-03-27-reveal-file-paths.md b/docs/_posts/2018-03-27-reveal-file-paths.md new file mode 100644 index 0000000..01b31d8 --- /dev/null +++ b/docs/_posts/2018-03-27-reveal-file-paths.md @@ -0,0 +1,16 @@ +--- +layout: post +title: "Reveal log message source file paths by pressing left-arrow" +excerpt: Find out where log messages are coming from. +--- + +*(This change is in v0.8.4+)* + +If you want to know which file log messages are coming from, you can press the +left-arrow to reveal the unique name and then press it again to reveal the +full path. + +<script id="asciicast-ATHHpQiHVaTVxVRkhCv4ED7wT" + src="https://asciinema.org/a/ATHHpQiHVaTVxVRkhCv4ED7wT.js" + async> +</script> diff --git a/docs/_posts/2018-04-05-linux-magazine-tutorial.md b/docs/_posts/2018-04-05-linux-magazine-tutorial.md new file mode 100644 index 0000000..9d868b5 --- /dev/null +++ b/docs/_posts/2018-04-05-linux-magazine-tutorial.md @@ -0,0 +1,9 @@ +--- +layout: post +title: "Tutorial for lnav in Linux Magazine" +date: 2018-04-05 00:00:00 +--- + +Looks like there was an in-depth +[tutorial on lnav in Linux Magazine](http://www.linux-magazine.com/Issues/2017/196/Tutorials-lnav). +Unfortunately, I didn't notice until now and missed out on a hardcopy. diff --git a/docs/_posts/2018-05-17-tags-and-comments.md b/docs/_posts/2018-05-17-tags-and-comments.md new file mode 100644 index 0000000..c6f2fef --- /dev/null +++ b/docs/_posts/2018-05-17-tags-and-comments.md @@ -0,0 +1,22 @@ +--- +layout: post +title: "Support for tagging and commenting on log messages" +excerpt: Annotate log messages with your thoughts. +--- + +*(This change is in v0.8.4+)* + +If you have been wanting to add notes to log messages you might be interested +in, the new [`:comment`](https://docs.lnav.org/en/latest/commands.html#comment-text) +and [`:tag`](https://docs.lnav.org/en/latest/commands.html#tag-tag) commands. +These commands add a comment or tag(s) to the top message in the log view. +The comments and tags are saved in the session, so they will be restored +automatically when the file is reopened. These annotations can be searched +for using the regular search prompt and can be accessed in the +[log tables](https://docs.lnav.org/en/latest/sqlext.html#log-tables) using the +`log_tags` and `log_comment` columns. + +<script id="asciicast-yRTcQd2VMv3QZVs5597OyAAxI" + src="https://asciinema.org/a/yRTcQd2VMv3QZVs5597OyAAxI.js" + async> +</script> diff --git a/docs/_posts/2018-11-9-visual-filter-editor.md b/docs/_posts/2018-11-9-visual-filter-editor.md new file mode 100644 index 0000000..8fb59a4 --- /dev/null +++ b/docs/_posts/2018-11-9-visual-filter-editor.md @@ -0,0 +1,35 @@ +--- +layout: post +title: "Visual filter editor" +excerpt: A friendlier way to interact with filters. +--- + +*(This change is in v0.8.5+)* + +A visual filter editor has been added to make it easier to create, edit, +enable, disable, and delete filters. In the log or text views, pressing `TAB` +will open the filter editor panel. While the panel is in focus, the following +hotkeys can be used: + +- `i` - Create an IN filter that will only show lines that match the given + regular expression. +- `o` - Create an OUT filter that will hide lines that match the given regular + expression. +- `Space` - Toggle the filter between being enabled and disabled. +- `Enter` - Edit the selected filter. +- `Shift+D` - Delete the filter. +- `t` - Switch a filter from an IN to an OUT or vice-versa. +- `f` - Globally enable or disable filtering. + +When editing a filter, the main view will highlight lines that portion of the +lines that match the given regular expression: + +- Lines that match an OUT filter are highlighted with red; +- Lines that match an IN filter are highlighted with green. + +You can also press `TAB` to complete words that are visible in the main view. + +<script id="asciicast-tcHeLbqVImRVcxWTYIrm3v6bw" + src="https://asciinema.org/a/tcHeLbqVImRVcxWTYIrm3v6bw.js" + async> +</script> diff --git a/docs/_posts/2019-05-08-themes.md b/docs/_posts/2019-05-08-themes.md new file mode 100644 index 0000000..a145ca6 --- /dev/null +++ b/docs/_posts/2019-05-08-themes.md @@ -0,0 +1,28 @@ +--- +layout: post +title: Support for Themes +excerpt: Change the user-interface to your liking +--- + +*(This change is in v0.9.0+)* + +The lnav user-interface can now be customized by selecting one of the +builtin themes, like +[monocai](https://github.com/tstack/lnav/blob/master/src/themes/monocai.json) +and +[night-owl](https://github.com/tstack/lnav/blob/master/src/themes/night-owl.json), +or +[by defining your own theme](https://lnav.readthedocs.io/en/latest/config.html#theme-definitions). + +Selecting a theme can be done through the +[`:config`](https://docs.lnav.org/en/latest/commands.html#config-option-value) +command, like so: + +``` +:config /ui/theme monocai +``` + +Pressing `TAB` after the `/ui/theme ` will cycle through the available themes, +like so: + +![Animation of lnav cycling through themes](/assets/images/lnav-theme-cycle.gif) diff --git a/docs/_posts/2020-12-23-xpath-sql-function.md b/docs/_posts/2020-12-23-xpath-sql-function.md new file mode 100644 index 0000000..b0a7657 --- /dev/null +++ b/docs/_posts/2020-12-23-xpath-sql-function.md @@ -0,0 +1,39 @@ +--- +layout: post +title: Drilling down into XML snippets +excerpt: The new "xpath()" table-valued SQL function. +--- + +*(This change is in [**v0.10.0+**](https://github.com/tstack/lnav/releases/tag/v0.10.0))* + +XML snippets in log messages can now be queried using the +[`xpath()`](https://docs.lnav.org/en/latest/sqlext.html#xpath-xpath-xmldoc) +table-valued SQL function. The function takes an +[XPath](https://developer.mozilla.org/en-US/docs/Web/XPath), the XML snippet +to be queried, and returns a table with the results of the XPath query. +For example, given following XML document: + +```xml +<msg>Hello, World!</msg> +``` + +Extracting the text value from the `msg` node can be done using the following +query: + +```sql +SELECT result FROM xpath('/msg/text()', '<msg>Hello, World!</msg>') +``` + +Of course, you won't typically be passing XML values as string literals, you +will be extracting them from log messages. Assuming your log format already +extracts the XML data, you can do a `SELECT` on the log format table and join +that with the `xpath()` call. Since it can be challenging to construct a +correct `xpath()` call, lnav will suggest calls for the nodes it finds in any +XML log message fields. The following asciicast demonstrates this flow: + +<script id="asciicast-x89mrk8JPHBmB4pTbaZvTt8Do" + src="https://asciinema.org/a/x89mrk8JPHBmB4pTbaZvTt8Do.js" + async> +</script> + +The implementation uses the [pugixml](https://pugixml.org) library. diff --git a/docs/_posts/2021-05-03-tailing-remote-files.md b/docs/_posts/2021-05-03-tailing-remote-files.md new file mode 100644 index 0000000..9d1d15c --- /dev/null +++ b/docs/_posts/2021-05-03-tailing-remote-files.md @@ -0,0 +1,32 @@ +--- +layout: post +title: Tailing files on remote hosts +excerpt: Native support for tailing logs on machines accessible via SSH +--- + +*(This change is in [**v0.10.0+**](https://github.com/tstack/lnav/releases/tag/v0.10.0))* + +One of the new features in the upcoming v0.10.0 release of lnav is support +for tailing log files on remote hosts via SSH. This feature allows you to +view local files and files from multiple remote hosts alongside each other +in the log view. The only setup required is to ensure the machines can be +accessed via SSH without any interaction, meaning the host key must have +been previously accepted and public key authentication configured. Opening +a remote file is then simply a matter of specifying the location using the +common scp syntax (i.e. `user@host:/path/to/file`). + +When lnav accesses a remote host, it transfers an agent (called the +"tailer") to the host to handle file system requests from lnav. The agent +is an [αcτµαlly pδrταblε εxεcµταblε](https://justine.lol/ape.html) that +should run on most X86 Operating Systems. The agent will monitor the +files of interest and synchronize their contents back to the host machine. +In addition, the agent can be used to satisfy interactive requests for +TAB-completion of remote file paths and previewing directory and file +contents. + +The following asciicast shows lnav opening log files on MacOS and FreeBSD: + +<script id="asciicast-fblzf1Ir5Rr0b5wMGEJBb95ye" + src="https://asciinema.org/a/fblzf1Ir5Rr0b5wMGEJBb95ye.js" + async> +</script> diff --git a/docs/_posts/2022-05-01-regex101-integration.md b/docs/_posts/2022-05-01-regex101-integration.md new file mode 100644 index 0000000..02011ce --- /dev/null +++ b/docs/_posts/2022-05-01-regex101-integration.md @@ -0,0 +1,73 @@ +--- +layout: post +title: Integration with regex101.com +excerpt: Create/edit format files using regex101.com +--- + +*(This change will be in the upcoming v0.11.0 release)* + +Creating and updating format files for **lnav** can be a bit tedious and +error-prone. To help streamline the process, an integration with regex101.com +has been added. Now, you can create regular expressions for plaintext log +files on https://regex101.com and then create a skeleton format file with a +simple command. If you already have a format file that needs to be updated, +you can push the regexes up to regex101, edit them with their interface, and +then pull the changes back down as a format patch file. + +To further improve the experience of developing with format files, there is +also work underway to improve error messages. Many messages should be clearer, +more context is provided, and they should look nicer as well. For example, the +following error is displayed when a format regex is not valid: + +![Screenshot of an error message](/assets/images/lnav-invalid-regex-error.png) + +## Management CLI + +The regex101 integration can be accessed through the new "management-mode CLI". +This mode can be accessed by passing `-m` as the first option to **lnav**. The +management CLI is organized as a series of nested commands. If you're not sure +what to do at a given level, run the command as-is and the CLI should print out +help text to guide you through the hierarchy of commands and required +parameters. + +### Create a format from a regular expression + +The `regex101 import` command can be used to import a regular expression from +regex101.com and create or patch a format file. The command takes the URL of +the regex, the format name, and the name of the regex in the log format ( +defaults to "std" if not given). For example, the following command can be used +to import the regex at "https://regex101.com/r/zpEnjV/2" into the format named " +re101_example_log": + +```console +$ lnav -m regex101 import https://regex101.com/r/zpEnjV/2 re101_example_log +``` + +If the import was successful, the path to the skeleton format file will be +printed. You will most likely need to edit the file to fill in more details +about your log format. + +### Editing an existing regular expression + +If you have a log format with a regex that needs to be updated, you can push +the regex to regex101.com for editing with a command like (replace +"myformat_log"/"std" with the name of your format and regex): + +```console +$ lnav -m format myformat_log regex std regex101 push +``` + +Along with the regex, the format's samples will be added to the entry to ensure +changes won't break existing matches. If the push was successful, the URL for +the new regex101.com entry will be printed out. You can use that URL to edit the +regex to your needs. Once you're done editing the regex, you can pull the +changes down to a "patch" file using the following command: + +```console +$ lnav -m format myformat_log regex std regex101 pull +``` + +The patch file will be evaluated after the original format file and override +the values from the original. Once you are satisfied with the changes, you +can move the contents of the patch file to the original file and delete the +patch. diff --git a/docs/_posts/2022-08-04-pretty-errors.md b/docs/_posts/2022-08-04-pretty-errors.md new file mode 100644 index 0000000..b04c9e8 --- /dev/null +++ b/docs/_posts/2022-08-04-pretty-errors.md @@ -0,0 +1,46 @@ +--- +layout: post +title: Pretty error messages +excerpt: Error message improvements +--- + +*(This change will be in the upcoming v0.11.0 release)* + +Taking a page from compilers like rustc, I've spent some time +improving error messages to make them look nicer and be more +helpful. Fortunately, SQLite has improved their error reporting +as well by adding +[sqlite3_error_offset()](http://sqlite.com/c3ref/errcode.html). +This function can point to the part of the SQL statement that +was in error. As an example of the improvement, a SQL file +that contained the following content: + +```sql + +-- This is a test +SELECT abc), +rtrim(def) +FROM mytable; +``` + +Would report an error like the following on startup in v0.10.1: + +```text +error:/Users/tstack/.config/lnav/formats/installed/test.sql:2:near ")": syntax error +``` + +Now, you will get a clearer error message with a syntax-highlighted +code snippet and a pointer to the part of the code that has the +problem: + +![Screenshot of a SQL error](/assets/images/lnav-sql-error-msg.png) + +Inside the TUI, a panel has been added at the bottom to display these +long-form error messages. The panel will disappear after a short +time or when input is received. Here is an example showing an error +for an invalid regular expression: + +<script id="asciicast-lmYMLZsB02WbSO8VEz4aVLXa1" + src="https://asciinema.org/a/lmYMLZsB02WbSO8VEz4aVLXa1.js" + async> +</script> diff --git a/docs/_posts/2022-08-06-markdown-support.md b/docs/_posts/2022-08-06-markdown-support.md new file mode 100644 index 0000000..4504bbd --- /dev/null +++ b/docs/_posts/2022-08-06-markdown-support.md @@ -0,0 +1,33 @@ +--- +layout: post +title: Markdown Support +excerpt: A side effect of fancier help text +--- + +*(This change will be in the upcoming v0.11.0 release)* + +As part of the effort to polish the lnav TUI, I wanted to make the builtin +help text look a bit nicer. The current help text is a plain text file with +some ANSI escape sequences for colors. It's not easy to write or read. Since +Markdown has become a dominant way to write this type of document, I figured +I could use that and have the side benefit of allowing lnav to read Markdown +docs. Fortunately, the [MD4C](https://github.com/mity/md4c) library exists. +This library provides a nice event-driven parser for documents instead of +just converting directly to HTML. In addition, document structure is now +shown/navigable through the new breadcrumb bar at the top. I think the +result is pretty nice: + +<script id="asciicast-2hx3UiyzOHQXBQOBf31ztKvHc" + src="https://asciinema.org/a/2hx3UiyzOHQXBQOBf31ztKvHc.js" + async> +</script> + +## Viewing Markdown Files + +Files with an `.md` suffix will be considered as Markdown and will be +parsed as such. As an example, here is lnav displaying its README.md file: + +<script id="asciicast-iw4rwddZNGCe3v8DyOfItERG9" + src="https://asciinema.org/a/iw4rwddZNGCe3v8DyOfItERG9.js" + async> +</script> diff --git a/docs/_posts/2022-09-01-playground.md b/docs/_posts/2022-09-01-playground.md new file mode 100644 index 0000000..3cbaa11 --- /dev/null +++ b/docs/_posts/2022-09-01-playground.md @@ -0,0 +1,27 @@ +--- +layout: post +title: Playground and Tutorial +excerpt: Try lnav without having to install anything +--- + +To make it easier to try out **lnav**, I've deployed an ssh-based playground +and tutorial. You can SSH as follows to try them out: + +```console +$ ssh playground@demo.lnav.org +$ ssh tutorial1@demo.lnav.org +``` + +<script id="asciicast-HiiUMMmRKZh0uCVKm1Uw8WLlw" + src="https://asciinema.org/a/HiiUMMmRKZh0uCVKm1Uw8WLlw.js" + async> +</script> + +The playground has a couple of example logs to play with. The tutorial +tries to guide you through the basics of navigating log files with lnav. +The server is running on the free-tier of [fly.io](https://fly.io), so +please be kind. + +This effort was inspired by the `git.charm.sh` SSH server and by the +[fasterthanli.me](https://fasterthanli.me/articles/remote-development-with-rust-on-fly-io) +post on doing remote development on fly.io. diff --git a/docs/_posts/2022-09-24-vscode-extension.md b/docs/_posts/2022-09-24-vscode-extension.md new file mode 100644 index 0000000..6c7b78f --- /dev/null +++ b/docs/_posts/2022-09-24-vscode-extension.md @@ -0,0 +1,21 @@ +--- +layout: post +title: VSCode Extension for lnav +excerpt: Syntax highlighting for lnav scripts +--- + +I've published a simple [Visual Studio Code extension for lnav]( +https://marketplace.visualstudio.com/items?itemName=lnav.lnav) +that adds syntax highlighting for scripts. The following is a +screenshot showing the `dhclient-summary.lnav` script that is +builtin: + +![Screenshot of an lnav script](/assets/images/lnav-vscode-extension.png) + +The lnav commands, those prefixed with colons, are marked as +keywords and the SQL blocks are treated as an embedded language +and highlighted accordingly. + +If people find this useful, we can take it further and add +support for running the current script/snippet in a new lnav +process or even talking to an existing one. diff --git a/docs/_posts/2023-06-23-cursor-mode.md b/docs/_posts/2023-06-23-cursor-mode.md new file mode 100644 index 0000000..c0a9f1d --- /dev/null +++ b/docs/_posts/2023-06-23-cursor-mode.md @@ -0,0 +1,30 @@ +--- +layout: post +title: Cursor Mode +excerpt: Move around the main view using a cursor +--- + +*(This change is in [**v0.11.2+**](https://github.com/tstack/lnav/releases/tag/v0.11.2-rc3))* + +The major change in the v0.11.2 release is the addition of a "cursor mode" +for the main view. Instead of focusing on the top line for interacting +with **lnav**, a cursor line is displayed and interactions focus on that. +The arrow keys and the hotkeys that jump between bookmarks, like search +hits and errors, now move the focused line instead of scrolling the view. +To help provide context for what you're looking at, large jumps will keep +the focused line in the middle of the view. Smaller movements, like +moving the cursor above the top line, will scroll the view a small amount +so as not to be jarring. + +You can enable/disable cursor mode interactively by pressing `CTRL` + `x`. +Or, you can permanently enable cursor mode by running the following +`:config` command: + +``` +:config /ui/movement/mode cursor +``` + +<script async + id="asciicast-d94CmxlGM01I0L5HNn9qDn917" + src="https://asciinema.org/a/d94CmxlGM01I0L5HNn9qDn917.js"> +</script> |