From b904d5b9bf5f988ec46d1014b591fa553f3db752 Mon Sep 17 00:00:00 2001 From: Tomas Bzatek Date: Tue, 27 May 2014 11:35:02 +0200 Subject: journald: Add WQL query example to the docs ...to demonstrate flexibility and filtering basics. --- doc/admin/journald/usage.rst | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/doc/admin/journald/usage.rst b/doc/admin/journald/usage.rst index 535eeec..d9e00b8 100644 --- a/doc/admin/journald/usage.rst +++ b/doc/admin/journald/usage.rst @@ -24,6 +24,26 @@ instances in classic syslog-like format: see the :ref:`inst-enum-limit` remark. +Using WQL query for simple filtering +------------------------------------ + +From its nature LMIShell can only do simple filtering by matching exact property +values. However there's a posibility of constructing custom CQL or WQL queries +bringing more flexibility in specific test conditions. The result from the query +method call is a list of instances, similar to calling ``".associators()"`` or +``".instances()"``. + +The following example uses WQL query to get a list of messages with syslog +severity 3 (error) or higher: + +:: + + #!/usr/bin/lmishell + c = connect("localhost", "pegasus", "test") + for rec in c.root.cimv2.wql("SELECT * FROM LMI_JournalLogRecord WHERE SyslogSeverity <= 3"): + print "[severity %d] %s" % (rec.SyslogSeverity, rec.DataFormat) + + Iterating through the log ------------------------- -- cgit