summaryrefslogtreecommitdiffstats
path: root/docs/source/sqlext.rst
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--docs/source/sqlext.rst43
1 files changed, 43 insertions, 0 deletions
diff --git a/docs/source/sqlext.rst b/docs/source/sqlext.rst
index 221b100..3b0ee75 100644
--- a/docs/source/sqlext.rst
+++ b/docs/source/sqlext.rst
@@ -47,6 +47,14 @@ and maximum number of bytes returned by the server, grouped by IP address:
;SELECT c_ip, avg(sc_bytes), max(sc_bytes) FROM access_log GROUP BY c_ip
+.. note::
+
+ For reference, the PRQL query would look like this:
+
+ .. code-block:: elm
+
+ from access_log | stats.by c_ip {average sc_bytes, max sc_bytes}
+
After pressing :kbd:`Enter`, SQLite will execute the query using **lnav**'s
virtual table implementation to extract the data directly from the log files.
Once the query has finished, the main window will switch to the DB view to
@@ -71,6 +79,39 @@ The DB view has the following display features:
the `jget`_ function.
+PRQL Support (v0.12.1+)
+-----------------------
+
+`PRQL <https://prql-lang.org>`_ is an alternative database query language
+that compiles to SQLite. You can enter PRQL in the database query prompt
+and lnav will switch accordingly. A major advantage of using PRQL is that
+lnav can show previews of the results of the pipeline stages and provide
+better tab completion options.
+
+A PRQL query starts with the :code:`from` keyword that specifies the table
+to use as a data source. The next stage of a pipeline is started by
+entering a pipe symbol (:code:`|`) followed by a
+`PRQL transform <https://prql-lang.org/book/reference/stdlib/transforms/index.html>`_.
+As you build the query in the prompt, lnav will display any relevant
+help and preview for the current and previous stages of the pipeline.
+
+The following is a screenshot of lnav viewing a web access log with a
+query in progress:
+
+.. figure:: ../assets/images/lnav-prql-preview.png
+ :align: center
+
+ Screenshot of a PRQL query in progress
+
+The top half of the window is the usual log message view. Below that is
+the online help panel showing the documentation for the :code:`stats.count_by`
+PRQL function. lnav will show the help for what is currently under the
+cursor. The next panel shows the preview data for the pipeline stage
+that precedes the stage where the cursor is. In this case, the
+results of :code:`from access_log`, which is the contents of the access
+log table. The second preview window shows the result of the
+pipeline stage where the cursor is located.
+
Log Tables
----------
@@ -105,6 +146,8 @@ The following columns are builtin and included in a :code:`SELECT *`:
an :code:`UPDATE` or the :ref:`:comment<comment>` command.
:log_tags: A JSON list of tags for the message. This column can be changed
by an :code:`UPDATE` or the :ref:`:tag<tag>` command.
+ :log_annotations: A JSON object of annotations for this message.
+ This column is populated by the :ref:`:annotate<annotate>` command.
:log_filters: A JSON list of filter IDs that matched this message
The following columns are builtin and are hidden, so they will *not* be