Data Model > Available DSCs > Log DSC > Example SQL queries
 
Example SQL queries
This topic provides some examples of running SQL queries on log files using DM Query and the Log DSC. For details about how to set up DM Query to run the queries, see Running the example queries on log files using DM Query.
For further information on the SQL queries supported by the , see Basic SQL queries and Advanced SQL queries.
1. Select all log entries at log level error
SELECT *
FROM vdata
WHERE LogLevel >= {Error}
Here are some typical results:
2. Select all log entries containing specific text.
Use the LIKE keyword if you want the search to be case sensitive. For example:
SELECT *
FROM vdata
WHERE LogEntry LIKE '%PASSWORD%'
Use the Find function if you want the search to be case insensitive. For example:
SELECT *
FROM vdata
WHERE Not (LogEntry.Find('PASSWORD') = -1)
3. Select all log entries that were written after a specific date and time
SELECT *
FROM vdata
WHERE DateTime > '2001-11-7 8:10:20'
4. Show the number of errors logged by each component at each logging level
SELECT ComponentID,
Groupby.Col[1],
count(LogEntry)
FROM vdata
GROUP BY by ComponentID,
LogLevel on LogLevel.DefinedCategories()
ORDER BY ComponentID with(BaseSummaryRow)
5. Show the log files in the chain
SELECT distinct LogFile
FROM vdata
6. Sort the log entries by date and time
This is particularly useful when you are viewing all of the log files in a folder.
SELECT * FROM vdata ORDER BY DateTime
Requirements
UNICOM Intelligence Data Model
See also
Log DSC