Refine your search:

It seems like if you I have a numeric multivalued field, I should be able to use eval to take the max and min of the values per row.

For example, I have a 'bytes' field on my events. i form those events into transactions and now i have a nice multivalued 'bytes' field on my transaction rows.
From here I'd like to get the max and min values of bytes per row, ie so I end up with a single 'maxBytes' number per transaction row.

<my search> | transaction user | eval maxBytes=max(bytes)

However when I do this I end up with a multiValued maxBytes, and its exactly as though I had just done:

<my search> | transaction user | eval maxBytes=bytes

Is there a reason for why it works this way or is there a workaround for it?

asked 28 Jun '10, 18:15

sideview's gravatar image

sideview ♦
25.5k3543
accept rate: 46%

edited 07 May '11, 00:05


One Answer:

After re-reading the docs, it does seem like this would be a nice feature request. I think you have to use stats and not eval when you are using the max() function this way. It seems like you have to have a list of values for max in eval where as stats max() works fine with multi-valued fields. (There does seem to be some lacking features for multi-value fields like this. Another one would be that you can't simply add a value to a multi-value field without some ugly delimiter-based hacks.)

Perhaps this would be the best fit for your situation:

 ... | streamstats max(bytes) as maxBytes window=1

BTW. Make sure that use include mvlist="bytes" on your transaction command, or you will get a unique list of values for bytes instead of a one-for-one listing of your bytes values. (I guess this really only matters if your doing sum(bytes) or something like that, but this seems easy to overlook so I figured I point it out.)

link

answered 28 Jun '10, 18:17

Lowell's gravatar image

Lowell ♦
11.1k81289
accept rate: 41%

edited 28 Jun '10, 18:37

Thanks lowell. Extremely helpful. And I had not come across mvlist="bytes" yet, or noticed that transaction was only keeping distinct values by default.

(30 Jun '10, 16:29) sideview ♦
Post your answer
toggle preview

Follow this question

Log In to enable email subscriptions

RSS:

Answers

Answers + Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×395
×239
×88

Asked: 28 Jun '10, 18:15

Seen: 1,177 times

Last updated: 07 May '11, 00:05

Related questions

Copyright © 2005-2012 Splunk Inc. All rights reserved.