Sum adds the values of the numerical field being evaluated within the time range analyzed.
- Creates field named
... | sum(bytes_received) group by hostname
Sample log message:
Aug 2 04:06:08 : host=10.1.1.124: local/ssl2 notice mcpd: filesize=20454: diskutilization=0.4 : 01070638:5: Pool member 172.31.51.22:0 monitor status down.
Example based on sample log message above:
file*| parse "filesize=*" as filesize
| sum (filesize) group _sourceHost
Finds all messages that contain term file* and parses out all that have a filesize=value. It will then extract the value of filesize and will add all those values per host where those log messages are generated.
You can also use multiple aggregation operators on the same line of a query. For example:
max(amount) as amount_max, count(datetime) as datetime_count, sum(_size) as messages_size_sum, last(query) as last_query