diff options
author | Tomas Bzatek <tbzatek@redhat.com> | 2014-05-27 11:35:02 +0200 |
---|---|---|
committer | Tomas Bzatek <tbzatek@redhat.com> | 2014-05-27 11:35:02 +0200 |
commit | b904d5b9bf5f988ec46d1014b591fa553f3db752 (patch) | |
tree | 17c71df9f9d22135631598da977a4acef040c247 | |
parent | d0a0b7c271ec282c31b05a12f5272df28288e5e7 (diff) | |
download | openlmi-providers-b904d5b9bf5f988ec46d1014b591fa553f3db752.tar.gz openlmi-providers-b904d5b9bf5f988ec46d1014b591fa553f3db752.tar.xz openlmi-providers-b904d5b9bf5f988ec46d1014b591fa553f3db752.zip |
journald: Add WQL query example to the docs
...to demonstrate flexibility and filtering basics.
-rw-r--r-- | doc/admin/journald/usage.rst | 20 |
1 files changed, 20 insertions, 0 deletions
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 ------------------------- |