5.11.2 Extract Column

The information in a log might be structured in columns as shown in sample A log containing comma separated values, e.g. the pieces of information might be separated by commas or other delimiters (column separated values, CSV).

These columns will be called CSV columns in this section and must not be confused with the columns used in Ascolog Insight to display log data in the Log window. These columns will be called log window columns in this section.

The following steps are required to extract CSV columns from a log and to display them in their own log window columns. In the Details window all information that belongs to such CSV columns should be selected even if some information might not be of interest. This means that in sample A log containing comma separated values the complete line “Type;Time;Code1;Code2;Amount” or “1;2013-03-13 15:39:33,767;0x18AC;0x1928;34;” should be selected even if the CSV column which contains e.g. the timestamps might not be of interest.

Type;Time;Code1;Code2;Amount

1;2013-03-13 15:39:33,767;0x18AC;0x1928;34;

1;2013-03-13 15:39:33,767;0x18AC;0x1928;34;

1;2013-03-13 15:39:38,304;0x1230;0x1864;33;

1;2013-03-13 15:39:38,350;0x1230;0x1864;33;

A log containing comma separated values

After selecting a line right-click on the Details window to open the context menu. In the context menu you have to select Extract and Column to start the Extract Column dialog which is shown in figure Extract Column dialog after opening. In the Select column field the selected text from the Details window is displayed.

Extract Column dialog after opening
Extract Column dialog after opening

The first step is always to select the separator which is used to separate the CSV columns in the in the Separator field. The next step is to select a CSV column that should be extracted from the Select column field. This will update the Selected Column, Prefix and Extract fields. If the fields are set as desired the data column extraction can be started by clicking Save or Save & Reload. If only the Save button is pressed the appropriate command will be created in the layout's custom columns definition but the changes won't be applied to the Log window and the Extract Column dialog will stay open. This is useful when several CSV columns have to be extracted. Press Save & Reload after you specified the last CSV column that should be extracted to reload the layout and apply the changes to the Log window. If you press the Close button the dialog is closed.

The Group... button enables you to extract several CSV columns in one step. It opens the Column Group dialog shown in figure Column Group dialog where you can define what CSV columns should be extracted and their names in the Log window. The Column Group dialog makes a suggestion for the names of the log window columns. This is most useful when you selected a line that contains descriptive headers of the CSV data. Select a column and press the Edit... button to change the column's name. Select the columns you want to keep and press the Keep button to keep these columns and to remove the non-selected columns. If you press the Remove button the selected columns will be removed and the non-selected columns will be kept. You can select multiple columns by pressing the CTRL key while selecting columns. It is also possible to define the format of a column as described in table Extract Column options by pressing the Format... button. In order to execute the Group command the Save & Apply button in the Column Group dialog must be pressed. 

Column Group dialog
Column Group dialog

The fields of the Extract Column dialog are described in detail in table Extract Column options.

Extract Column options
Property Description
Selected column After the dialog pops-up this control displays the data selected in the Details window. The text that is selected in the ”Select the text part that has to precede the first column” edit control will be removed from this control. The CSV column to be extracted must be selected in this edit control. This will update the Prefix and Extract edit controls. Only one CSV column can be selected in one step. If several CSV columns should be extracted in one step the Group... command must be used.
Select the text part that has to precede the first column (optional) After the dialog pops-up this control displays the data selected in the Details window. The user can specify a text that must precede the first column. This will simplify the identification of the CSV columns in some cases and remove unnecessary text. The selected text will be removed from the Selected Column edit control. It will be added to the Preceding Text edit control after the data to be extracted is selected in the Selected column edit control.

Example line: Running applications: App1, App2, App3

Select “Running applications” as preceding text. This will remove the text “Running applications” from the columns to be created and identify the CSV columns.

Column Defines the column and its name in the Log window to be used for displaying the extracted data column.
Separator Defines the delimiter that separates the CSV columns.
Prefix Specifies the data that precedes the data to be extracted. Regular expressions might be used.
Extract Specifies the data to be extracted. The data is defined using regular expressions.
Format

Unformatted - the extracted text is left aligned, no padding
Right-aligned, space padding - the extracted text is right aligned and padded with spaces on its left side
Right-aligned, zero padding - the extracted text is right aligned and padded with zeros on its left side
Left-aligned, space padding - the extracted text is left aligned and padded with spaces on its right side
Left-aligned, zero padding - the extracted text is left aligned and padded with zeros on its right side

The number of padding characters can be configured.