It is, but it's not really a very good way of using Splunk if that's your main purpose:
... | rex "\((?<id>[^\(\)]*)\)" | rex max_match=99999 field=id ",?(<v>[^,]*),?" | eval c=mvcount(v)
Another way of doing this is:
... | eval c = len(replace(_raw,"[^,]","")) + 1
(or rex out the list first if there might be other commas in the _raw field, and I'm assuming the list can't be empty.)
It would be a lot better if you perhaps described to us where the source data originally comes from and whether there's a better way to get your result. It is also sometimes useful if you let us know what you are going to do with this count, in case the ultimate result is easier or better than simply counting
It is, but it's not really a very good way of using Splunk if that's your main purpose:
... | rex "\((?<id>[^\(\)]*)\)" | rex max_match=99999 field=id ",?(<v>[^,]*),?" | eval c=mvcount(v)
Another way of doing this is:
... | eval c = len(replace(_raw,"[^,]","")) + 1
(or rex out the list first if there might be other commas in the _raw field, and I'm assuming the list can't be empty.)
It would be a lot better if you perhaps described to us where the source data originally comes from and whether there's a better way to get your result. It is also sometimes useful if you let us know what you are going to do with this count, in case the ultimate result is easier or better than simply counting
The two examples I gave are intended to do that.
Sorry, we actually fixed this problem by having them add logging.. but here was the problem.. there is a SQL statement in the log with a Select blah in (x, y, z)... I needed the COUNT of items in the IN clause (in the parens).
I don't quite understand the question. Could you give a line or two of data (either raw or in tabular form) as well as the answer you want to get?