From c796a662731b5bdb74196af0a4dfd0cbdf96e285 Mon Sep 17 00:00:00 2001 From: Tim Stack Date: Mon, 4 Sep 2023 22:51:07 -0700 Subject: [PATCH] [blog] add post about the new "config" management commands --- docs/Gemfile.lock | 8 ++-- docs/_posts/2023-08-04-config-dump.md | 56 +++++++++++++++++++++++++++ 2 files changed, 61 insertions(+), 3 deletions(-) create mode 100644 docs/_posts/2023-08-04-config-dump.md diff --git a/docs/Gemfile.lock b/docs/Gemfile.lock index 275c580b..c20611d2 100644 --- a/docs/Gemfile.lock +++ b/docs/Gemfile.lock @@ -1,11 +1,12 @@ GEM remote: https://rubygems.org/ specs: - activesupport (7.0.5) + activesupport (6.1.7.6) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) tzinfo (~> 2.0) + zeitwerk (~> 2.3) addressable (2.8.4) public_suffix (>= 2.0.2, < 6.0) coffee-script (2.4.1) @@ -210,9 +211,9 @@ GEM jekyll-feed (~> 0.9) jekyll-seo-tag (~> 2.1) minitest (5.18.1) - nokogiri (1.15.2-arm64-darwin) + nokogiri (1.13.10-arm64-darwin) racc (~> 1.4) - nokogiri (1.15.2-x86_64-linux) + nokogiri (1.13.10-x86_64-linux) racc (~> 1.4) octokit (4.25.1) faraday (>= 1, < 3) @@ -250,6 +251,7 @@ GEM unf_ext (0.0.8.2) unicode-display_width (1.8.0) webrick (1.8.1) + zeitwerk (2.6.11) PLATFORMS arm64-darwin-21 diff --git a/docs/_posts/2023-08-04-config-dump.md b/docs/_posts/2023-08-04-config-dump.md new file mode 100644 index 00000000..cfa94719 --- /dev/null +++ b/docs/_posts/2023-08-04-config-dump.md @@ -0,0 +1,56 @@ +--- +layout: post +title: Tooling for troubleshooting configuration +excerpt: Getting the final configuration and the sources of values +--- + +*(This change is in **v0.12.0+**)* + +Inspired by [this blog post about reporting configuration file locations](https://utcc.utoronto.ca/~cks/space/blog/sysadmin/ReportConfigFileLocations) +and the [ensuing HackerNews commentary](https://news.ycombinator.com/item?id=36465886). +I've added the `config get` and `config blame` management commands for getting the +final configuration and the source of each property in the configuration, respectively. +I had previously added the file locations used by **lnav** in the `lnav -h` output as +recommended by the blog post. But, the HN comments made a good case for adding the +the other troubleshooting tooling as well. + +If you would like to try out these new commands, you need to run lnav with the `-m` +option to switch to the "management" mode. For example, just running lnav with this +flag will print out the available operations: + +```console +$ lnav -m +✘ error: expecting an operation to perform + = help: the available operations are: + • config: perform operations on the lnav configuration + • format: perform operations on log file formats + • piper: perform operations on piper storage + • regex101: create and edit log message regular expressions using regex101.com +``` + +Executing `config get` will print out the final configuration that lnav is operating +with as JSON: + +```console +$ lnav -m config get +``` + +If you would like to know the source of the value for each property, you can use +the `config blame` command, like so: + +```console +$ lnav -m config blame | tail +/ui/theme-defs/solarized-light/vars/black -> solarized-light.json:15 +/ui/theme-defs/solarized-light/vars/blue -> solarized-light.json:21 +/ui/theme-defs/solarized-light/vars/cyan -> solarized-light.json:22 +/ui/theme-defs/solarized-light/vars/green -> solarized-light.json:23 +/ui/theme-defs/solarized-light/vars/magenta -> solarized-light.json:19 +/ui/theme-defs/solarized-light/vars/orange -> solarized-light.json:17 +/ui/theme-defs/solarized-light/vars/red -> solarized-light.json:18 +/ui/theme-defs/solarized-light/vars/semantic_highlight_color -> solarized-light.json:24 +/ui/theme-defs/solarized-light/vars/violet -> solarized-light.json:20 +/ui/theme-defs/solarized-light/vars/yellow -> solarized-light.json:16 +``` + +In the above output, "solarized-light.json" file is built into the lnav +executable and is not from the file system.