Queries

Query Builder Overview

There is a distinction between queries and reports:

Use the Query Builder to define and modify queries. There is a separate Query Builder for each domain, and it is opened from the Query Finder for that domain (see Open the Query Finder). By default, the Query Builder panel name is Custom Reporting for a user portal, but for admin role users, the Query Builder panel takes its name from the menu selection used to open the query builder (Access Tracking, Exceptions Tracking, Alert Tracking, etc).

The query builder contains three panes:

The title line for the query displays the query name and the main entity, and contains two controls:

The Main Entity

The entities within a domain are related to one another, usually in a hierarchical order. For example, in the Data Access domain, the Client/Server entity contains Session entities, which contain Access Period entities, and so forth.

The main entity that you select for a query determines:

Sorting

By default, query data is sorted in ascending order by attribute value, with the sort keys ordered as the attributes appear in the query. If aliases are being used, they are ignored for sorting purposes; the actual data values are always used for sorting. Attributes for which values are computed by the query (Count, Min, Max, or Avg) cannot be sorted.

To change the default sort order:

  1. Mark the Order-by box.

  2. Enter a number in the Sort Rank box (1 is the most major sort key).

  3. Optionally, mark the Descend box to sort the values of that attribute in descending sequence.

As mentioned elsewhere, the last column of a tabular report is a count of main entity occurrences. To sort on this count in descending sequence (in other words, listing the greatest number occurrences first), mark the Sorted by occurrences checkbox above the Query Fields title bar.

Timestamps

A timestamp (lowercase “t”) is a data type containing a combined date-and-time value, which when printed displays in the format yyyy-mm-dd hh:mm:ss (e.g., 2005-07-17 15:40:25). When creating or editing a query, most attributes with a timestamp data type display with a clock icon in the Entity List panel.

A Timestamp (uppercase “T”) is an attribute defined in many entity types, containing the time that the entity was last updated. For many timestamp attributes, you can print the date, time, weekday or year components separately, by referencing additional Timestamp attributes (Date, Time Weekday, or Year).

Group Domain Query Requirement

When creating a query in the Group domain, if you include an attribute from the Group Member entity in either the Query Fields or Query Conditions, you must also include an attribute from the Group entity (the Group Description, for example).

Query Fields Overview

The Query Fields pane basically lists the columns of data to be returned by the query.

Add Fields to the Query Fields Pane

There are two ways to add a field to the Query Fields pane:

Regardless of the method used, the field will be added to the end of the list.

Move or Remove Fields in the Query Fields Pane

To move a field in the Query Fields pane:

  1. Mark the checkbox in the left-most column for the field.

  2. Use the following buttons to move the field to the desired location:

To remove a field from the Query Fields pane:

  1. Mark the checkbox in the left-most column for the field.

  2. Click to remove the field.

Aggregate Fields

The Field Mode list selection indicates what to print for the field: its Value, or the Count, Min, Max, or Average (AVG) for the row. The Value option is not available for attributes from entities lower than the main entity in the entity hierarchy for the domain.

A Caution about Full SQL Attributes in Queries

Beware of using the Full SQL attribute in a query. It may produce excessively large reports, because each distinct value of the attribute (the complete SQL query string in this case) will be returned in a separate row.

On the other hand, the report may contain no information at all, or many blank columns where you are expecting Full SQL strings. Guardium captures Full SQL only when directed to do so by policy rules - and the rules may not have been triggered during the reporting period.

Do not confuse the Full SQL attribute with the ability to drill down to the SQL for most queries in the Data Access domain having anything to do with SQL requests.

Query Conditions Overview

The Query Builder allows you to create complex query conditions by adding multiple attributes to the Query Conditions pane. Each attribute added defines an additional test that will be AND'd or OR'd with the other tests, as described below.

Add or Remove a Query Condition

  1. To remove a query condition, mark the checkbox in the row for that condition, and click   in the Query Conditions pane title bar.

  2. To add a condition, first create a row in the Query Conditions list for the appropriate field from the Entity List pane. The way you do this depends on whether you are creating an AND condition or an OR condition.

To add an AND condition, do one of the following:

To add an OR condition, do one of the following:

  1. Optional. Use the Aggregate drop-down to select an aggregate of the attribute to be used for the query condition: Count, Min (minimum value), Max (maximum value), or AVG (average value). Restrictions apply, as follows:

  2. Select the operator for the new condition from the list below. Not every attribute type will have the same set of operators available; for example, attributes that cannot be associated with groups will not have any of the group options (IN GROUP, LIKE GROUP, etc.)

Operator

Description

<

Less than

< =

Less than or equal to

< >

Not equal to

=

Equal to

>

Greater than

> =

Greater than or equal to

CATEGORIZED AS

Member of a group belonging to the category selected from the drop-down list to the right, which appears when a group operator is selected.

CLASSIFIED AS

Member of a group belonging to the classification selected from the drop-down list to the right, which appears when a group operator is selected.

IN DYNAMIC GROUP

Member of a group that will be specified as a runtime parameter.

IN GROUP

Member of the group selected from the drop-down list to the right, which appears when a group operator is selected.

IS NOT NULL

Attribute value exists, but may be blank or unprintable

IS NULL

Empty attribute

IN PERIOD

For a timestamp only, is within the selected time period

LIKE

Matches a like value specified in the boxes to the right. A like value uses the percent sign as a wildcard character, and matches all or part of the value. Alphabetic characters are not case sensitive. For example, %tea% would match tea, TeA, tEam, steam. If no percent signs are included, the comparison operation will be an equality operation (=).

LIKE GROUP

Matches any member of a group that may contain wildcard member names. For example, if the group contained a member named %tea%, it would match tea, TeA, tEam, steam, etc.

NOT IN DYNAMIC GROUP

Not equal to any member of a group, which will be specified as a runtime parameter

NOT IN GROUP

Not equal to any member of the specified group

NOT IN PERIOD

For a timestamp only, not within the selected time period

NOT LIKE

Not like the specified value (see the description of LIKE, above)

NOT REGEX

Not matched by the specified regular expression

REGEX

Matched by the specified regular expression

Note: The Guardium implementation of regular expressions conforms with POSIX 1003.2. The specification can be viewed from:
http://www.unix.org/version3/ieee_std.html
.

  1. For a group operator, select a group from the list that appears to the right of the operator.

    For most other operators, you must supply a value for the condition, or indicate that a runtime parameter value will be supplied later (when the query is executed). In these cases, a drop-down with three options appears to the right of the operator. Do one of the following:

  2. When you are done adding all conditions, remember to save the definition.

Open the Query Finder

There is a separate Query Builder for each reporting domain, so it is important to open the correct Query Builder. Otherwise, you will not see the information you want! All domains are described in the Domains topic of the Domains, Entities and Attributes Appendix.

After determining which domain to use, do one of the following to open the Query Finder for that domain:

Either one of these options opens the Query Finder for the selected domain. If not, see the Problems topic, just below. Otherwise return to the top of this topic to begin defining a new query, or modifying an existing one.

Problems opening or finding the query builder?

If you attempt to open a Query Builder for which your Guardium account is not authorized, you will receive an error message:

Error: You do not have the privileges to run this application.

Check with your Guardium administrator if you receive this message, but believe you should have access to the domain.

If you do not see the Query Builder you want to use, you may need to add it to a custom tab. Not all Query Builders are included on the default user layout. See Portal Customization for instructions on how to add a Query Builder to your layout.

Search for a Query

To locate and view a query definition in the Query Builder, there are several options:

Use the Query Finder

  1. Open the Query Finder for the appropriate domain (see Open the Query Finder, above).

  2. Optional. If you know the Main Entity for the query, select it from the list.

  3. Click Search.

  4. Do one of the following:

Create a Query

  1. Open the Query Finder for the appropriate domain (see Open the Query Finder, above).

  2. Click the New button to open the New Query – Overall Details panel.

  3. Type a unique query name in the Query Name box. Do not include apostrophe characters in the query name.

  4. Select the main entity for the query from the Main Entity list. Remember that the main entity controls the level of detail that will be available for the query, and that it cannot be changed. Basically, each row of data returned by the query will represent a unique instance of the main entity, and a count of occurrences for that instance.

  5. Click the Next button. The new query opens in the Query Builder panel. To complete the definition, see one of the following topics:

Modify a Query

  1. Open the Query Finder for the appropriate domain (see Open the Query Finder, above).

  2. Use the Query Finder to open the query to be modified.

  3. Refer to the Query Builder Overview topic above to modify any component of the query definition.

Clone a Query

  1. Open the Query Finder for the appropriate domain (see Open the Query Finder, above).

  2. Use the Query Finder to open the query to be cloned.

  3. Click the Clone button at the bottom of the panel. The original query name will  be replaced by a text box.

  4. Type a unique name for the cloned query in the text box. Do not include apostrophe characters in the query name.

  5. Click the Save button at the bottom of the panel.

  6. To complete the definition, see one of the following topics:

Remove a Query

  1. Open the Query Finder for the appropriate domain (see Open the Query Finder, above).

  2. Use the Query Finder to open the query to be removed.

Note: You cannot remove a query that is being used by some other component. To delete such a query, you must first delete all components that use it (reports or correlation alerts, for example).

  1. Click the Remove button near the bottom of the panel. You will be prompted to confirm the action.

Generate a Tabular Report Quickly

Once a query has been defined, there are several options for adding a tabular report based on that query to an existing menu layout, quickly. These options apply only for tabular reports, and those reports can only be added to menu layouts.

  1. Open the Query Finder for the appropriate domain (see Open the Query Finder, above).

  2. Use the Query Finder to open the query to use for the report.

  3. Do one of the following:

Note that the default user portal contains a My New Reports pane, but the default admin portal does not. If your portal does not contain a My New Reports pane (for whatever reason), you will receive an error message. If it does not exist, you can create this pane anywhere on your portal (see Portal Customization, in the Common Tools book). If you create a My New Reports pane, be sure to: