Activity Feed
- Got Karma for Re: mvexpand multiple multi-value fields?. 03-18-2022 08:50 AM
- Karma Re: How to extract X number of fields based on another field value in the data? for sundareshr. 06-05-2020 12:48 AM
- Karma Re: how to mask data in data model? for Ayn. 06-05-2020 12:47 AM
- Karma Re: How can I split an event into two or more events according to two multivalue fields? for acharlieh. 06-05-2020 12:47 AM
- Got Karma for Re: How to extract a value from a JSON multivalue field based on a value from another multivalue field?. 06-05-2020 12:47 AM
- Got Karma for Re: How to extract a value from a JSON multivalue field based on a value from another multivalue field?. 06-05-2020 12:47 AM
- Got Karma for Re: How can I edit my search to only use the 3 most recent sources?. 06-05-2020 12:47 AM
- Got Karma for Re: How to get a stats sum of a column available in every row?. 06-05-2020 12:47 AM
- Got Karma for Re: How to get a stats sum of a column available in every row?. 06-05-2020 12:47 AM
- Got Karma for Re: How to get a stats sum of a column available in every row?. 06-05-2020 12:47 AM
- Karma Re: Is there a search or other way to easily list the indexes I am permissioned to search? for gkanapathy. 06-05-2020 12:46 AM
- Karma mvexpand multiple multi-value fields: How do I turn my three multi-value fields into tuples? for nathanh42. 06-05-2020 12:45 AM
- Got Karma for Re: mvexpand multiple multi-value fields?. 06-05-2020 12:45 AM
- Got Karma for Re: mvexpand multiple multi-value fields?. 06-05-2020 12:45 AM
- Got Karma for Re: mvexpand multiple multi-value fields?. 06-05-2020 12:45 AM
- Got Karma for Re: mvexpand multiple multi-value fields?. 06-05-2020 12:45 AM
- Got Karma for Re: mvexpand multiple multi-value fields?. 06-05-2020 12:45 AM
- Got Karma for Re: mvexpand multiple multi-value fields?. 06-05-2020 12:45 AM
- Got Karma for Re: mvexpand multiple multi-value fields?. 06-05-2020 12:45 AM
- Got Karma for Re: mvexpand multiple multi-value fields?. 06-05-2020 12:45 AM
Topics I've Started
No posts to display.
09-07-2017
08:16 AM
Thanks @sk314. To be fair, this question was left unanswered for four years and 35 hours. Some improvements have been made to the docs since this answer, but this example is still better, IMO.
... View more
11-18-2015
10:50 AM
Updated with sundareshr's spath command instead of rex.
... View more
11-18-2015
10:47 AM
That's a better way to create the fields than what I did, but you still need to use mvzip() and mvexpand to get the correct value.
... View more
11-18-2015
10:43 AM
Glad it worked! Working with multivalue fields is often unintuitive.
Sweet dreams.
... View more
11-18-2015
08:59 AM
2 Karma
Here's a solution, assuming there is only one billId per event
| spath output=value bodyLines{}.value
| spath output=caption bodyLines{}.caption
| eval zipped=mvzip(value,caption)
| mvexpand zipped
You'll now have a separate event for each value. You can read caption and value as a pair:
| makemv delim="," zipped
| eval adjustedConsumption=if(mvindex(zipped, 1) = "Adjusted Consumption", mvindex(zipped, 0), '')
Or create new fields for them and filter out the other results:
| makemv delim="," zipped
| eval caption=mvindex(zipped, 1)
| eval value=mvindex(zipped, 0)
| search caption = "Adjusted Consumption"
... View more
07-20-2015
09:02 AM
1 Karma
The metadata command can list sources, which can be used as a subsearch. This will search the top three sources:
[| metadata type=sources | sort recentTime desc | head 3 | fields source] | additional_commands_after_pipe...
Metadata takes an index parameter. If you need to limit it to certain sources, you'd need to search for it:
[| metadata type=sources index="test_inputs" | search source="Servers ALL*" | sort recentTime desc | head 3 | fields source] | additional_commands_after_pipe...
Subsearches can be slow, but the metadata command should be reasonably fast.
... View more
07-20-2015
08:43 AM
3 Karma
The command name makes this unintuitive, but you can use eventstats to add this to every row...
| eventstats count(eval(dead=1)) as sumOfDead
| eventstats count(eval(dead=0)) as sumOfAlive
... View more
06-19-2015
04:06 PM
This solved the blank values issues in the first column...
search ...
| filldown 'Name-field'
You can then dedup and sort the table...
| dedup 'Name-field' 'Server-field' 'Server-attribute'
| sort 0 'Name-field' 'Server-field'
If you really need to null out the Name-field...
| streamstats current=f window=1 global=f last('Name-field') as previous
| eval 'Name-field'=if('Name-field'==previous, "", 'Name-field')
| fields - previous
You may need to reverse the table afterward ...
| reverse
... View more
06-19-2015
04:01 PM
Are you also saying that the Name-field is blank in the some rows ( the second for example)? Do you need to use the "filldown" command, before running dedup on all three fields?
... View more
06-04-2015
02:03 PM
To make this work via "add eval", you'd need to create a new field with a different name in the data model and hide the old field. The display name can be whatever you'd like.
Another option is to do that eval in a root search -> Add object -> Root search.
... View more
06-04-2015
01:15 PM
This works...
your search | fields column1 column2 column3 | table * | fields - _*
However, do you really need to pipe to table?
If you just show events and format it as a table, then the extra column would disappear. In the search, you can select "Table" on the events tab. Unfortunately, if you save this as a dashboard panel the settings are getting lost. In SimpleXML, here are the settings you need:
<panel>
<event>
<search>
<query>your search</query>
</search>
<option name="count">10</option>
<option name="rowNumbers">0</option>
<option name="type">table</option>
<fields>column1, column2, column3</fields>
</event>
</panel>
Note, this method would also include _time.
... View more
06-04-2015
11:37 AM
25 Karma
Use mvzip, makemv and then reset the fields based on index.
First, mvzip the multi-values into a new field:
| eval reading=mvzip(vivol, usage) // create multi-value field for reading
| eval reading=mvzip(reading, limit) // add the third field
At this point you'll have a multi-value field called reading. Here's an example of a field value (a list of four items):
"VOL_ABC,100,300", "VOL_XYZ,320,800", "VOL_123, 50,150", "VOL_FOO, 80,120"
Expand the field and restore the values:
| mvexpand reading // separate multi-value into into separate events
| makemv reading delim="," // convert the reading into a multi-value
| eval vivol=mvindex(reading, 0) // set vivol to the first value of reading
| eval usage=mvindex(reading, 1) // set usage to the second value of reading
| eval limit=mvindex(reading, -1) // set limit to the last value of reading
... View more
06-04-2015
11:10 AM
Most eval functions balk with multi-value fields. I'm skipping over strptime in these examples, but know that you need a single value field for strptime.
If you just need to work with the first or last values, you can put them into new fields before working with them.
| eval start_date_first=mvindex(start_date, 0)
| eval start_date_last=mvindex(start_date, -1)
| eval end_date_first=mvindex(end_date, 0)
| eval end_date_last=mvindex(end_date, -1)
Another option is to create a separate row for each users start and end date:
| eval periods=mvzip(start_date, end_date) // create multi-value field for with pairs of comma separated dates
| mvexpand periods // separate each pair into separate events
| makemv periods delim="," // separate the pair into a multi-value
| eval start_date=mvindex(periods, 0) // set the first value to start_date
| eval end_date=mvindex(periods, -1) // set the last value to end_date
I've broken this down a little granularly than necessary. Many of these could be combined, but remember you often need to cast mvindex() output into a type with tostring() or tonumber(). For intance:
| eval foo= mvindex(bar, 0) * 2 // always throws error
| eval foo= tonumber(mvindex(bar, 0)) * 2 // works
... View more