[docs] fill out search-table docs

This commit is contained in:
Timothy Stack 2022-07-13 22:24:49 -07:00
parent 4c20b0039c
commit d1521496cc
8 changed files with 46 additions and 3 deletions

View File

@ -1,4 +1,5 @@
Sphinx>=3.4.3
sphinx>=4.3.0
sphinx-jsonschema
sphinx-prompt
pathlib
sphinx-rtd-theme>=0.5.1

View File

@ -177,15 +177,27 @@ Log level
^^^^^^^^^
To hide messages below a certain log level, you can use the
:ref:`:set-min-log-level<set_min_log_level>`.
:ref:`:set-min-log-level<set_min_log_level>` command.
.. _search_tables:
Search Tables
-------------
TBD
Search tables allow you to access arbitrary data in log messages through
SQLite virtual tables. If there is some data in a log message that you can
match with a regular expression, you can create a search-table that matches
that data and any capture groups will be plumbed through as columns in the
search table.
Creating a search table can be done interactively using the
:ref:`:create-search-table<create_search_table>` command or by adding it to
a :ref:`log format definition<log_formats>`. The main difference between
the two is that tables defined as part of a format will only search messages
from log files with that format and the tables will include log message
columns defined in that format. Whereas a table created with the command
will search messages from all different formats and no format-specific
columns will be included in the table.
.. _taking_notes:

View File

@ -209,6 +209,22 @@ execute_sql(exec_context& ec, const std::string& sql, std::string& alt_msg)
for (int lpc = 0; lpc < param_count; lpc++) {
std::map<std::string, std::string>::iterator ov_iter;
const auto* name = sqlite3_bind_parameter_name(stmt.in(), lpc + 1);
if (name == nullptr) {
auto um
= lnav::console::user_message::error(
"invalid SQL statement")
.with_reason(
"using a question-mark (?) for bound variables "
"is not supported, only named bound parameters "
"are supported")
.with_help(
"named parameters start with a dollar-sign "
"($) or colon (:) followed by the variable name");
ec.add_error_context(um);
return Err(um);
}
ov_iter = ec.ec_override.find(name);
if (ov_iter != ec.ec_override.end()) {
sqlite3_bind_text(stmt.in(),

View File

@ -98,6 +98,10 @@
"pattern": "/SessionStats/SessionPool/Session/Id='(?<SessionId>[^']+)'/Username='(?<Username>[^']+)'/ClientIP='(?<ClientIP>[^']+)'(?<ProfileKey>[^ ]+) (?<ProfileValue>[^\\n]+)",
"glob": "*/vpxd-profile*"
},
"vpxd_session_pool_stats": {
"pattern": "/SessionStats/SessionPool/Id='(?<SessionId>[^']+)'/Username='(?<Username>[^']+)'(?<ProfileKey>[^ ]+) (?<ProfileValue>[^\\n]+)",
"glob": "*/vpxd-profile*"
},
"vpx_lro_begin": {
"pattern": "\\[VpxLRO\\] -- BEGIN (?<lro_id>\\S+) -- (?<entity>\\S*) -- (?<operation>\\S*) -- (?:(?<SessionId>[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})(?:\\((?<SessionSubId>[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\\))?)?"
},

View File

@ -420,6 +420,8 @@ EXPECTED_FILES = \
$(srcdir)/%reldir%/test_sql.sh_57edc93426e6767aa44ab2356c55327553dcdc8d.out \
$(srcdir)/%reldir%/test_sql.sh_5801770f3e0ecc1d62c7a97116d6da1981bbc7bd.err \
$(srcdir)/%reldir%/test_sql.sh_5801770f3e0ecc1d62c7a97116d6da1981bbc7bd.out \
$(srcdir)/%reldir%/test_sql.sh_5fe26fe4fc22f23f8dbe3a6aab394602886f2971.err \
$(srcdir)/%reldir%/test_sql.sh_5fe26fe4fc22f23f8dbe3a6aab394602886f2971.out \
$(srcdir)/%reldir%/test_sql.sh_62eb85c9569e71a630d72065238559528a16114c.err \
$(srcdir)/%reldir%/test_sql.sh_62eb85c9569e71a630d72065238559528a16114c.out \
$(srcdir)/%reldir%/test_sql.sh_662b5f9b17aa69a8e3aa9a18acb30d9acf6e2837.err \

View File

@ -0,0 +1,5 @@
✘ error: invalid SQL statement
reason: using a question-mark (?) for bound variables is not supported, only named bound parameters are supported
 --> command-option:1
 | ;SELECT 1 = ? 
 = help: named parameters start with a dollar-sign ($) or colon (:) followed by the variable name

View File

@ -5,6 +5,9 @@ export YES_COLOR=1
lnav_test="${top_builddir}/src/lnav-test"
unset XDG_CONFIG_HOME
run_cap_test ${lnav_test} -nN \
-c ";SELECT 1 = ?"
run_cap_test ${lnav_test} -n \
-c ";.read nonexistent-file" \
${test_dir}/logfile_empty.0