How do you calculate the totals of each single row of a table and display that value in a new fields, much like addcoltotals but for rows?
Use eval
.
index=foo | eval total=field1 + field2 + field3 | table field1, field2, field3, total
You can also use foreach
if you don't want to add the fields yourself.
index=foo | fields - _time | eval total=0 | foreach * [eval total=total+<<FIELD>>] | table *
Hi John,
I hope you must have got the answer but just for addition,
You can also use addtotals in the last of your SPL so it will add a new column named "Total" as last of the columns. and for each row as a result, it will be sum of numeric values of every column in the table.
Thanks
Use eval
.
index=foo | eval total=field1 + field2 + field3 | table field1, field2, field3, total
You can also use foreach
if you don't want to add the fields yourself.
index=foo | fields - _time | eval total=0 | foreach * [eval total=total+<<FIELD>>] | table *