6.8. Context-Diving

Context-diving retrieves the contextual data around a point of interest in your results. You start from the statistics chart or from selected result entries, or you look directly into the source file of an entry (see Show Source Context and Browse File).

Individual entries in the result table often attract your interest, but because they were obtained with restrictive search criteria you are missing the surrounding context. If, for example, you searched the logs for the text Error, you only obtain entries that contain that exact term.

Five routes from the statistics chart and the result entries to more context

Fig. 6.38 Routes to the context of a result.

  1. Right-click a chart bar and choose Search this time period in a new tab. The new tab keeps the last run’s criteria. Its time criterion spans the bar, and the tab does not start.

  2. Click a bar or drag across bars to filter the result table by that time range.

  3. Right-click selected entries to open a new tab with a time frame based on the selection, or for all data of their files.

  4. Show source context shows the raw lines around one entry of a local or SSH file.

  5. Browse File shows the whole file of an entry in a scroller window or tab.

6.8.1. Based on the Statistics Chart

The statistics chart above the result table gives a quick overview of how the detected log entries are distributed over the search period. Each bar represents a time slice; error and warning entries are shown in distinct colors. The more entries the result holds, the more bars the chart shows, as many as its width allows. When you place the mouse pointer over a bar, a tooltip shows the time span of that slice and the number and type of entries found in it. It also tells what a click, a drag and a right-click on the bar do. Click a bar to filter the result table by its time slice; the range slider and the range detail chart then open below the chart (see Filtering by a Time Range).

The statistics chart above the result table, with a bar tooltip

Fig. 6.39 The statistics chart above the result table; hovering a bar shows its time slice and the number and type of entries found in it.

6.8.1.1. Filtering by a Time Range

Click a bar of the statistics chart to narrow the result table to the bar’s time slice, a Time Range, without starting a new search. To select several bars, drag across them and release the mouse button. The result table then shows only the entries inside that range, and two more controls open under the statistics chart. The range resolves down to milliseconds while the result is small enough. A very large result is shown in coarser steps.

The statistics chart with a selected time range, the range slider and the range detail chart

Fig. 6.40 A time range selected with a click on a bar of the statistics chart.

  1. The clicked bar. Its time slice is now the range.

  2. The Range Slider shows the selected range. Drag its middle to move the range. Drag one of its ends to change where the range starts or ends.

  3. The start and the end of the range, to the millisecond.

  4. The Range Detail Chart shows only the entries inside the range, on finer time slices, down to single milliseconds. Click one of its bars to bring the first entry of that slice to the top of the result table.

  5. Click i-range-remove Remove to remove the range. A click on an empty part of the statistics chart does the same.

The mouse pointer tells you what a click or a drag does:

Pointer

Meaning

Hand, over a bar of the statistics chart

Click to select the bar’s entries as the range. Drag to select a new range. Right-click to open a new search tab for the bar, as described below.

Hand, over a bar of the range detail chart

Click to select the first entry of that bar in the result table. The table scrolls so the entry is at the top. Right-click to open a new search tab for the bar.

Arrow with two heads, over a range end

Drag to change where the range starts or ends. The range ends are shown as lines on the statistics chart and as the ends of the range slider.

Open hand, over the middle of the range slider

Drag to move the whole range. The hand closes while you drag.

Moving the range happens only on the range slider. Press Esc while dragging to cancel the drag and keep the range you had before. While a search is still loading, a click or a drag on the statistics chart does nothing and the pointer stays an arrow; the right-click menu still works.

“First” follows the current sort order of the result table. If the other local filters hide all entries of the bar, the message The result table shows none of the entries of this period appears.

Drag an end of the range to the edge of the chart to leave it open. A range that is open to the right keeps taking in new entries while monitoring. Drag both ends to the edges to remove the range.

The range is the result table’s local date/time filter (see Local Date/Time Filter). Setting a filter in the i-filter-datetime Filter result by date/time pop-up moves the range, and moving the range replaces the filter set there.

Note

The range detail chart counts every entry in the range, like the statistics chart. It ignores the other local filters. Both charts count only the entries still in the result. Entries you remove, and entries dropped because the result reached its storage limit, are no longer counted. A tab restored from an earlier session may redraw its statistics chart shortly after its entries appear. A tab opened from a snapshot shows its statistics chart at once; on a large result, its range detail chart is ready shortly after the entries appear.

6.8.1.2. Searching a Bar’s Time Period in a New Tab

Right-click a bar and choose i-search-clock Search this time period in a new tab. The new tab carries the criteria of the last run, not later edits, without empty text criteria. It is a search on the profile of the last run. Its time criterion spans the bar. The tab does not start the search.

Note

The new tab’s time criterion covers the bar’s entries exactly, so re-running the search normally returns the same number of entries the bar’s tooltip reported.

Two things can still make the counts differ. The Date/Time preferences page refuses a format without milliseconds (SSS). A format that reached the preferences another way, for example by editing the preferences file by hand (see Changing Configuration Location), may still lack them. Then it cannot express the bar’s boundaries, and Retrospective first shows Time search criteria format. Continue with OK, or select Don’t show again to skip it until you close Retrospective. And because the new search re-reads the data sources, a log file that has grown or changed since the original search can yield a different result.

6.8.2. Based on Result Entries

To retrieve the context around one or more specific entries, select the row(s) of interest in the result table and right-click to open the result table context menu. The context-diving items open a new search tab that holds only the time criterion. Your text criteria are not carried over. The tab does not start; run it when ready. If the Date/Time format lacks milliseconds, the same warning as for the statistics chart appears first (see Based on the Statistics Chart).

Two submenus offer the same set of time frames, differing only in the profile the new search runs against:

  • i-search-clock Search with same profile: runs against the current profile (all of its data sources).

  • i-search-clock Search in selected path(s): runs against an ad-hoc, temporary profile narrowed to only the files in which the selected entries were found.

In addition, i-start-search Search all data in selected path(s) opens a path-restricted search with no time restriction at all.

For results restored from a previous session or opened from a snapshot, both path-restricted searches leave out entries whose host no longer exists. If none remain, Retrospective reports The selected path(s) cannot be searched. Unknown host(s): <host> in the Status view and opens no tab.

Each submenu offers the following time frames, derived from the selected entry’s timestamp. Each item except Between selection needs exactly one selected entry.

Icon

Menu item

Retrieves

i-search-from-sel-min

Start 10 seconds beforehand

data starting 10 seconds before the selected entry.

i-search-from-sel-min

Start 1 minute beforehand

data starting 1 minute before the selected entry.

i-search-to-sel

10 seconds beforehand up to selection

data written during the 10 seconds preceding the selected entry, up to the entry itself.

i-search-to-sel

1 minute beforehand up to selection

data written during the minute preceding the selected entry, up to the entry itself.

i-search-from-sel

Start at selection

data written at the same time as, and after, the selected entry.

i-search-plus-min-sel

plus/minus 10 seconds from selection

data written during the 10 seconds before and the 10 seconds after the selected entry.

i-search-plus-min-sel

plus/minus 1 minute from selection

data written during the minute before and the minute after the selected entry.

i-search-between-sel

Between selection

data written between the timestamps of the selected entries (requires two or more selected rows).

The Search with same profile submenu expanded with its time frames

Fig. 6.41 The Search with same profile submenu, showing the available time frames derived from the selection.

6.8.3. Show Source Context

The context-diving searches above run a new search. The two features below look directly into the source file of a result entry, without any search criteria. Both are available for entries that come from a file, local or accessed through SSH, whose host still exists. Container log streams and Windows event logs have no file to look into. Show source context needs exactly one selected row. For Browse File, all selected rows must come from the same file.

i-show-source-context Show source context in the result table context menu opens a window with the raw, unparsed file content around the selected entry. It shows a chosen number of lines before and after the entry. The entry’s lines are centered and highlighted in light green, the color of an active local filter. The window is not modal, so the result table stays usable next to it.

Show Source Context window with the selected entry highlighted in light green

Fig. 6.42 The Show source context window: the selected entry is highlighted, with 25 lines of the source file on each side.

  • The Lines box selects how many lines are loaded on each side: 10, 25 (the default), 50, 100 or 1000.

  • i-word-wrap Enable line wrapping at word boundaries wraps long lines at word boundaries. Japanese katakana terms are kept on one line.

  • While the lines load, Fetching data and Cancel appear.

  • Text can be selected and copied (right-click Copy or Ctrl+C). The view is read-only; there is no save function.

  • Esc or Close closes the window.

The displayed slice is capped at 4 MB. When an entry or its context exceeds the cap, the view is truncated and a note in the status line says so.

6.8.4. Browse File

i-find Browse File and i-find Browse File in New Tab both sit in the result table context menu. They open the complete file of the selected entry as a scrollable table with the Date/Time, Level and Data columns. The entries are parsed and formatted like the result table, but the table shows every entry of the file without any filtering. Browse File opens a separate window; Browse File in New Tab opens the same view as a tab titled with the file name. A browse tab is not restored when the application restarts.

The view opens scrolled to the entry you came from, with that entry selected, so you can see at a glance which row it was. The entry also carries the search-match color in both layouts, so it stays marked after you select another row. Retrospective loads the file in blocks around the visible position:

  • The vertical scrollbar represents the whole file by its byte position, so even a multi-gigabyte file can be navigated directly. Because log entries differ in length, the scrollbar speed can feel non-uniform across regions of the file.

  • Home and End jump to the start and end of the file; Page Up / Page Down move one screen; the arrow keys move by entry or line.

  • When you jump into a part of the file that is not loaded yet, the current content stays visible. A Fetching data indicator with a Cancel button appears in the status bar until the new block arrives. The status bar also shows the file size.

  • The selected entry stays selected while it is loaded. Jumping to a part of the file that does not contain it clears the selection; scrolling back to it selects it again.

The toolbar offers the row-layout button (Single line cells / Multi line cells; in the multi-line layout a timestamp too wide for its column wraps as well) and the formatting controls of the result detail pane. These are word wrap, JSON/XML formatting with syntax highlighting and pretty-print, the JSON array, unescape and restore toggles, and the indentation width. Find, the marker toggles and correlation are not offered. i-detail-edit-prefs Edit formatting preferences opens the Formatting preferences page. On the right, the save buttons i-save-html i-save-text i-save-csv i-save-excel i-save-json read Save to HTML file and so on. They save the whole file content to an HTML, Text, CSV, Excel or JSON file, using the same options dialogs as the result-table export (see Exporting Result Data).

While a block is being fetched or a file is being saved, the toolbar is locked. If you try to close the window then, a message asks you to cancel the operation from the progress bar first.

Closing the window brings the window you opened it from back to the front: the main window, or the detached window holding the search tab.