4.2. Custom Columns

Custom Columns are result table columns that you define yourself. Each one shows a part of your log data that Retrospective extracts from the log entries. This page describes how you define such a column and which types of Field supply its values.

Log data found during search and monitoring is shown in the result table in a predefined set of columns: Date/Time, Level, Data, Host and Path. The Data column contains the full, non-structured content of individual result entries. To show chosen parts of your log data in columns of their own, define Custom Columns. Besides giving the column a name, you tell Retrospective how to collect the data for its cells; you do this by defining Fields.

In most cases there are no strict rules on how log data is produced. The semantically same fields can appear in different places and with distinct formats all over your log files. Retrospective therefore allows more than one Field to be assigned to the same Custom Column. Retrospective currently supports the following types of Fields:

  • Name/Value Pattern Fields, offered predefined under Name/Value Pair, and under Detected in Data when Retrospective has found such fields in your data.

  • Regular Expression Fields, defined in the Custom Regular Expression category.

  • The Delimited Data category, holding Split Fields (also called character separated fields), Fixed Position Fields, and the Data Before, Data Between and Data After fields.

  • Standalone Number Fields, in the Standalone Number category.

The sections below describe each of these types.

Custom Columns are best defined for individual profiles within the Profiles tab of the Profile Manager. If you work with log files selected on the fly, you can define Custom Columns within the Configure Data Source(s) dialog for the current search tab. Definitions made there are lost once you close the search tab.

4.2.1. Name/Value Pattern Fields and Regular Expression Fields

A common practice in programming is to log contextual information using name/value patterns. Many different patterns are often used for logging the same data. That makes it hard to extract the most meaningful values automatically and present them in a custom column. Retrospective knows the name/value patterns that programmers commonly use. It therefore detects them during Autofind and even during search and monitoring. It proposes them as Name/Value Pattern Fields that you can assign to Custom Columns.

A Name/Value Pattern Field is a special subtype of the more general Regular Expression Field. A Regular Expression Field is a field whose value is extracted by matching a defined regex. A Name/Value Pattern is also defined by a regex, but only the fragment of the match that represents the value is extracted as the Field value.

Retrospective provides predefined fields in the groups Date/Time, Internet and Programming, and for amounts with currency. Name/Value Pattern Fields can be detected automatically by Retrospective. Regular Expression Fields must be defined manually. In Windows Event Logs, field detection also proposes the event details as Regular Expression Fields, see Field Detection. For example, to show an IP address in a column, select IPv4 Address in the Internet group.

The figure below shows how three Name/Value Pattern Fields and one Regular Expression Field extract the same semantic information: a person ID number.

Name/value patterns and a regular expression extracting the same person ID into one custom column

Fig. 4.2 Name/Value Pattern Fields and a Regular Expression Field extracting the same information.

  1. The profile.

  2. Its two data sources.

  3. The custom column Person-No..

  4. Three Name/Value Pattern Fields, one per notation of the person ID.

  5. A Regular Expression Field for the notation that has no name/value separator.

  6. The result table.

  7. The Date/Time column.

  8. The Data column.

  9. The extracted person IDs. An entry without a person ID leaves the cell empty.

4.2.2. Split Fields

A Split Field, also called a character separated field, is offered in the Delimited Data category of the Add Field dialog.

Your log files may contain tabular data, known as CSV file format. When individual log entries of such files are split by a certain character, for example a comma, the same number of fields is obtained. All fields at a given position but from different log entries have the same semantics. The field at position one may contain the customer type, the field at position two its ID, the field at position three an action code, and so on.

It is up to you to find out how such log files are structured. Then define your Custom Columns and assign a Split Field to each of them by specifying the separator and the field position. The Separator drop-down offers Character, Space, Tab Character, String and Regex. One split field can also fill several columns at once. The figure below shows how different Split Fields extract values from a given log entry. Extracting the same information with a Name/Value Pattern Field or a Regular Expression Field would be hard.

A log entry split by a separator character into positional fields feeding custom columns

Fig. 4.3 Split Fields extracting positional values from tabular log data.

  1. The profile.

  2. Its two data sources.

  3. The separator character |.

  4. Position 1 stays empty: Retrospective removes the timestamp first, and Ignore Empty Fields is off by default.

  5. The custom columns, each with the position of its field.

  6. The result table.

  7. The Date/Time column.

4.2.3. Fixed Position Fields

Some log entries are not separated at all but written in fixed-width columns, so a value always occupies the same character positions. A Fixed Position Field extracts such a value by its Begin Position and End Position, or a Length, within the log entry, where the first character is position 1. It is offered in the Delimited Data category next to the Split Field.

Use a Fixed Position Field only where the layout really is fixed. A value can shift by even one character, because a preceding field is sometimes longer. A Split Field or a Regular Expression Field extracts such a value reliably; a Fixed Position Field does not.

4.2.4. Data Before, Between and After Fields

Log entries often carry an interesting value next to a known text fragment, without following a name/value pattern. These three fields, also in the Delimited Data category, extract such a value relative to one or two delimiters that you define:

  • Data Before: extracts the data that appears before a right delimiter.

  • Data Between: extracts the data that appears between a left and a right delimiter.

  • Data After: extracts the data that appears after a left delimiter.

A Left Delimiter or Right Delimiter can be any character sequence. For each delimiter, Included decides whether it is part of the extracted value or cut off.

4.2.5. Standalone Number Fields

A Standalone Number Field extracts an integer or decimal number that stands alone in the log entry. The number is surrounded by whitespace or located at the start or end of the entry. You choose the kind of number to look for: Any Standalone Number, Standalone Positive Number, Standalone Negative Number or Standalone Zero. The numbers are parsed with a locale, which defines the expected thousands and decimal separators. With Use Date Locale, the locale is taken from the date locale of the data source. Otherwise Locale applies, and with the date locale on it serves as Fallback Locale for data sources without a date locale.

4.2.6. Field Detection

Field detection identifies and collects potentially interesting name/value fields present in log entries. It proposes them on request for assignment to custom columns. The detection does not cover Split Fields, nor Regular Expression Fields apart from the event details described below. Field detection occurs in the following cases.

  • Always during Autofind.

  • During search and monitoring, while field detection is on. The toggle next to the start button then shows i-field-detection-enabled, and its tooltip reads Disable field detection during search/monitoring. The Detection during search/monitoring option on the Field Detection preferences page sets the default.

  • Before a field selection dialog opens.

Field detection tries to match the following name/value patterns. Spaces around = and : are allowed up to the limits set on the Field Detection preferences page.

Name/Value Pattern

Description

name=value

May appear at start/end of log entry or must be non-alphanumerically delimited. Name and value must not contain spaces. The value may be empty if = is directly followed by , ; & | a closing bracket, a line break or the end of the log entry.

name:value

May appear at start/end of log entry or must be non-alphanumerically delimited. Name and value must not contain spaces.

name='value'

Name must not contain spaces, but value may contain spaces.

name="value"

Name must not contain spaces, but value may contain spaces.

name=(value)

Name must not contain spaces, but value may contain spaces.

name=[value]

Name must not contain spaces, but value may contain spaces.

name={value}

Name must not contain spaces, but value may contain spaces.

name=<value>

Name must not contain spaces, but value may contain spaces.

(name=value)

Name and value may contain spaces.

[name=value]

Name and value may contain spaces.

{name=value}

Name and value may contain spaces.

"name": "value" (JSON)

Value in JSON may be a number, boolean, null or a quoted string.

\"name\": \"value\" (escaped JSON)

Same as the JSON pattern, for log entries in which the quotes of the embedded JSON are backslash-escaped.

In Windows Event Logs, while Report event details is on (see Event Format), field detection also proposes each - name: value line of the event details as a Regular Expression Field. Its value runs to the end of the line, so paths, spaces and quotes are kept. A value that spans several lines is reported on one line, with a space between its lines. Any other line of the entry that starts with - name: value is proposed the same way. The name proposed for an event detail carries the Event details prefix, by default Evt-, for example Evt-SubjectUserName.

Autofind reads the oldest entries of an event log. Field detection therefore also reads the newest event of each event provider and event ID, among the newest 200,000 events of the source. So the event details of events that occur only later are proposed as well. On a large event log this adds a few seconds.

4.2.7. Field Extraction

Field extraction matches individual field expressions during search and monitoring. It provides the extracted field values for the corresponding custom columns of the result table.

  • Field extraction is always performed during search and monitoring if the selected profile contains at least one visible custom column.

  • Fields from individual custom columns are processed top-down for each result entry. As soon as a value is found, remaining fields are ignored.

  • A field expression that cannot be evaluated on one entry within half a second of processing time stops the search or monitoring with an error naming the expression.

A given Custom Column can have several Fields of different types assigned. Consider two log entry flavors that both carry a person number. In the first flavor, a Name/Value Pattern Field extracts it; in the second, a Split Field has to. Assign the Name/Value Pattern Field to the column as the first Field, and the Split Field as the second. If the Name/Value Pattern Field does not match, Retrospective tries the Split Field. A profile can hold at most 50 columns, the five standard columns included, so at most 45 custom columns.