logsift

Pivot

The Pivot tab (below the log, next to Profile) makes a pivot table of a table’s rows, as in a spreadsheet, and a chart of it. It is there for every CSV or TSV file; for another log with columns, right-click a column title → Pivot Table and Chart. Every row is counted: nothing is sampled, and a million rows take about a second.

A pivot of sales: regions down the side, products across, the amounts summed, and a column chart below

Fields and areas

On the right, Fields lists the file’s columns, each with its kind: # numbers, ◷ times, Aa text. find a field narrows a long list. It takes part of a name, or a pattern: * is any text and ? one character. For example, cpu_* is every column starting with cpu_, *_ms every column ending in _ms, and cpu_1? is cpu_10 to cpu_19. With more than one field shown, Add the 10 to: Values · Values as One · Rows · Columns · Filters puts them all in that area at once (at most 200 at a time), which helps with tables of hundreds or thousands of columns. Put fields in the four areas below it:

Area What it does
Rows Groups the rows down the side, one line per value. A second field groups inside the first (region › month), with a subtotal on each group’s line
Columns Splits each value across the top, one column per value of the field, plus a Total column
Values What the cells hold: Sum, Count, Count distinct, Average, Min, Max, Median, 95th percentile or 99th percentile of a field (percentiles interpolated, as spreadsheets do; past a million numbers in a cell, from a fair sample of a million). With no values, the cells count the rows
Filters Keeps only rows with some values of a field: click it → Choose Values… and untick the ones to leave out

Many fields as one value

To see all of abc_1, abc_2, … abc_40 summed up in one column, type abc_* in find a field and click Values as One. Values gets one field, Sum of abc_* (40 fields), and each cell holds every value of those fields for its group: put a field in Rows (say host) and each host’s line has the sum of all its abc_ numbers.

Pivot: one host per row, and every cpu_1? field summed up in one column

The layout is remembered for each file (which fields are where, how they sum up and group), and comes back when you open the file again. A filter’s chosen values aren’t remembered.

The table

The chart

**Table Both Chart** shows the table, the table with its chart below, or the chart alone. The chart shows the table’s rows (the innermost shown, folded groups as one) and a series per column (or per value): Column, Stacked Column, 100% Stacked Column, Bar, Stacked Bar, Line, Area, Stacked Area, Pie and Doughnut. Hover a bar, a point or a slice for its numbers; click it to select its row in the table.

Months under each region, counted as % of each row, as a line chart

Export ▾ saves the table as CSV or the chart as a PNG picture, or copies either (the chart as a picture to paste in a document or a chat).

With the filters

Like Profile and Metrics, the pivot follows Matching only: with it on, it counts only the lines the log’s filters keep, and the tab says so in a strip on top (Only the 225 of 2,099 lines the filters keep, with a link to count every line).

Big tables

A table of millions of rows, or of thousands of columns, is read once for the first pivot, then kept: Pivot stores the columns it used in a cache, and every pivot after that over the same columns takes milliseconds instead of reading the whole file again. The status says from the cache.

A pivot of 300,000 rows from the cache, in 34 ms

For coding agents

Agents get the same Pivot through the pivot tool (Coding agents): rows by one or more fields (host, timestamp:hour), columns by another, values such as count, sum(ms), avg(bytes), median(ms), p95(ms), count_distinct(user), and a pattern for many fields as one (sum(cpu_*)). Filters keep some values (status=500; host=web-1|web-2), values can show as a % of the grand total, the row or the column, and groups can be sorted by their total. The answer is the table as text, with the same numbers as the Pivot tab. A big table’s pivots come from the same cache as in the app, so the columns one has kept serve the other.