<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: finding repetition in array of logs in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/finding-repetition-in-array-of-logs/m-p/360013#M106441</link>
    <description>&lt;P&gt;&lt;CODE&gt;stats values(array) AS array first(requests) AS request by _serial&lt;/CODE&gt; with that, my request field is still empty, I think the &lt;CODE&gt;by _serial&lt;/CODE&gt; possibly?&lt;/P&gt;</description>
    <pubDate>Thu, 22 Jun 2017 18:06:19 GMT</pubDate>
    <dc:creator>exocore123</dc:creator>
    <dc:date>2017-06-22T18:06:19Z</dc:date>
    <item>
      <title>finding repetition in array of logs</title>
      <link>https://community.splunk.com/t5/Splunk-Search/finding-repetition-in-array-of-logs/m-p/360003#M106431</link>
      <description>&lt;P&gt;I have a field in my logs that contains an array of string elements. Is there a way to detect for repeating strings and parse it differently within the search query for a dashboard?&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;array = ["string1", "string2","string1"]&lt;/CODE&gt; regardless of however many repetition&lt;/P&gt;

&lt;P&gt;into&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;array = "extra(string1), string2"&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jun 2017 03:58:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/finding-repetition-in-array-of-logs/m-p/360003#M106431</guid>
      <dc:creator>exocore123</dc:creator>
      <dc:date>2017-06-21T03:58:47Z</dc:date>
    </item>
    <item>
      <title>Re: finding repetition in array of logs</title>
      <link>https://community.splunk.com/t5/Splunk-Search/finding-repetition-in-array-of-logs/m-p/360004#M106432</link>
      <description>&lt;P&gt;I think that it is possible to search by string search if you want to search. What exactly do you want to do?&lt;BR /&gt;
Do you want to know the number of repetitions?&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jun 2017 04:27:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/finding-repetition-in-array-of-logs/m-p/360004#M106432</guid>
      <dc:creator>HiroshiSatoh</dc:creator>
      <dc:date>2017-06-21T04:27:55Z</dc:date>
    </item>
    <item>
      <title>Re: finding repetition in array of logs</title>
      <link>https://community.splunk.com/t5/Splunk-Search/finding-repetition-in-array-of-logs/m-p/360005#M106433</link>
      <description>&lt;P&gt;Do you have a field called &lt;CODE&gt;array&lt;/CODE&gt; right now?  Does it have 1 value, 2 values, or 3 values for your example?&lt;BR /&gt;
What &lt;EM&gt;EXACTLY&lt;/EM&gt; would you like to do with &lt;CODE&gt;array&lt;/CODE&gt;?&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jun 2017 04:53:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/finding-repetition-in-array-of-logs/m-p/360005#M106433</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-06-21T04:53:37Z</dc:date>
    </item>
    <item>
      <title>Re: finding repetition in array of logs</title>
      <link>https://community.splunk.com/t5/Splunk-Search/finding-repetition-in-array-of-logs/m-p/360006#M106434</link>
      <description>&lt;P&gt;I dont care for the number of repetitions, I just want to know if there are repetition of the string within that field called &lt;CODE&gt;array&lt;/CODE&gt;, then on my tabular dashboard, I want to display it as &lt;CODE&gt;extra(...) , (rest of the strings)&lt;/CODE&gt;.  For instance with the example above, say the &lt;CODE&gt;array&lt;/CODE&gt; within logs are displayed as &lt;CODE&gt;array=["string1", "string2", "string1"]&lt;/CODE&gt;, I want to be able to parse it as &lt;CODE&gt;"Extra(string1), string2"&lt;/CODE&gt; on my dashboard. Array can have repetitive values, or different values across the board, assume we do not know &lt;CODE&gt;array&lt;/CODE&gt;'s length. &lt;/P&gt;</description>
      <pubDate>Wed, 21 Jun 2017 05:51:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/finding-repetition-in-array-of-logs/m-p/360006#M106434</guid>
      <dc:creator>exocore123</dc:creator>
      <dc:date>2017-06-21T05:51:20Z</dc:date>
    </item>
    <item>
      <title>Re: finding repetition in array of logs</title>
      <link>https://community.splunk.com/t5/Splunk-Search/finding-repetition-in-array-of-logs/m-p/360007#M106435</link>
      <description>&lt;P&gt;Hi exocore123,&lt;BR /&gt;
are you speaking about a multi values field that you want to put in different events?&lt;BR /&gt;
if this is your need you should try &lt;CODE&gt;makemv&lt;/CODE&gt; and &lt;CODE&gt;mvexpand&lt;/CODE&gt; commands, something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your_search
| makemv multi_values_field
| mvexpand multi_values_field
| ...
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jun 2017 07:07:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/finding-repetition-in-array-of-logs/m-p/360007#M106435</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2017-06-21T07:07:44Z</dc:date>
    </item>
    <item>
      <title>Re: finding repetition in array of logs</title>
      <link>https://community.splunk.com/t5/Splunk-Search/finding-repetition-in-array-of-logs/m-p/360008#M106436</link>
      <description>&lt;P&gt;It is not really multi-value? More of just a different representation&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jun 2017 07:30:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/finding-repetition-in-array-of-logs/m-p/360008#M106436</guid>
      <dc:creator>exocore123</dc:creator>
      <dc:date>2017-06-21T07:30:36Z</dc:date>
    </item>
    <item>
      <title>Re: finding repetition in array of logs</title>
      <link>https://community.splunk.com/t5/Splunk-Search/finding-repetition-in-array-of-logs/m-p/360009#M106437</link>
      <description>&lt;P&gt;Hi exocore123,&lt;BR /&gt;
sorry but I don't understand your situation, could you share a sample of your logs and the expected output?&lt;BR /&gt;
Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jun 2017 07:36:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/finding-repetition-in-array-of-logs/m-p/360009#M106437</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2017-06-21T07:36:37Z</dc:date>
    </item>
    <item>
      <title>Re: finding repetition in array of logs</title>
      <link>https://community.splunk.com/t5/Splunk-Search/finding-repetition-in-array-of-logs/m-p/360010#M106438</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval array="[\"string1\", \"string2\", \"string1\"]
[\"string1\", \"string2\", \"string3\"]
[\"string2\", \"string2\", \"string1\"]"
| makemv delim="
" array
| mvexpand array

| rename COMMENT AS "Everything above generates sample event data; everything below is your solution"

| fields array
| rex field=array mode=sed "s/\"//g s/^\[// s/\]$//"
| eval array=split(array, ",")
| rex field=array mode=sed "s/^\s+//"
| streamstats count AS _serial
| mvexpand array
| stats count BY array _serial
| eval array=if((count=1), array, "Extra(" . array . ")")
| stats values(array) AS array BY _serial
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Then maybe you would like to add:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| nomv array
| eval array = "[" . array . "]"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 21 Jun 2017 16:59:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/finding-repetition-in-array-of-logs/m-p/360010#M106438</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-06-21T16:59:18Z</dc:date>
    </item>
    <item>
      <title>Re: finding repetition in array of logs</title>
      <link>https://community.splunk.com/t5/Splunk-Search/finding-repetition-in-array-of-logs/m-p/360011#M106439</link>
      <description>&lt;P&gt;I am trying to add another stats line at the end of line 19, but seems to return 0 results. &lt;CODE&gt;stats count by requests, array&lt;/CODE&gt; , do you have any suggestion on how to use this as well as using stats within the same query?&lt;/P&gt;</description>
      <pubDate>Thu, 22 Jun 2017 17:35:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/finding-repetition-in-array-of-logs/m-p/360011#M106439</guid>
      <dc:creator>exocore123</dc:creator>
      <dc:date>2017-06-22T17:35:28Z</dc:date>
    </item>
    <item>
      <title>Re: finding repetition in array of logs</title>
      <link>https://community.splunk.com/t5/Splunk-Search/finding-repetition-in-array-of-logs/m-p/360012#M106440</link>
      <description>&lt;P&gt;The &lt;CODE&gt;fields array&lt;/CODE&gt; command drops all fields other than &lt;CODE&gt;array&lt;/CODE&gt; so you need to change line 11 to &lt;CODE&gt;fields array requests&lt;/CODE&gt; and you also need to change line 19 to &lt;CODE&gt;stats values(array) AS array first(requests) AS requests BY _serial&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Thu, 22 Jun 2017 17:49:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/finding-repetition-in-array-of-logs/m-p/360012#M106440</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-06-22T17:49:09Z</dc:date>
    </item>
    <item>
      <title>Re: finding repetition in array of logs</title>
      <link>https://community.splunk.com/t5/Splunk-Search/finding-repetition-in-array-of-logs/m-p/360013#M106441</link>
      <description>&lt;P&gt;&lt;CODE&gt;stats values(array) AS array first(requests) AS request by _serial&lt;/CODE&gt; with that, my request field is still empty, I think the &lt;CODE&gt;by _serial&lt;/CODE&gt; possibly?&lt;/P&gt;</description>
      <pubDate>Thu, 22 Jun 2017 18:06:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/finding-repetition-in-array-of-logs/m-p/360013#M106441</guid>
      <dc:creator>exocore123</dc:creator>
      <dc:date>2017-06-22T18:06:19Z</dc:date>
    </item>
    <item>
      <title>Re: finding repetition in array of logs</title>
      <link>https://community.splunk.com/t5/Splunk-Search/finding-repetition-in-array-of-logs/m-p/360014#M106442</link>
      <description>&lt;P&gt;OK, like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval array="[\"string1\", \"string2\", \"string1\"]
[\"string1\", \"string2\", \"string3\"]
[\"string2\", \"string2\", \"string1\"]"
| makemv delim="
" array
| mvexpand array
| streamstats count AS results
| eval results=results+10

| rename COMMENT AS "Everything above generates sample event data; everything below is your solution"

| fields array results
| rex field=array mode=sed "s/\"//g s/^\[// s/\]$//"
| eval array=split(array, ",")
| rex field=array mode=sed "s/^\s+//"
| streamstats count AS _serial
| mvexpand array
| stats count first(results) AS results BY array _serial
| eval array=if((count=1), array, "Extra(" . array . ")")
| stats values(array) AS array first(results) AS results BY _serial
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 22 Jun 2017 18:24:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/finding-repetition-in-array-of-logs/m-p/360014#M106442</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-06-22T18:24:09Z</dc:date>
    </item>
    <item>
      <title>Re: finding repetition in array of logs</title>
      <link>https://community.splunk.com/t5/Splunk-Search/finding-repetition-in-array-of-logs/m-p/360015#M106443</link>
      <description>&lt;P&gt;Hello Woodcock, sorry but to follow up, what happens if I want to remove the repetitions without splitting it, so for example &lt;CODE&gt;Extra(string1 + string2)&lt;/CODE&gt; for &lt;CODE&gt;array = ["string1", "string2","string1"]&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jun 2017 19:00:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/finding-repetition-in-array-of-logs/m-p/360015#M106443</guid>
      <dc:creator>exocore123</dc:creator>
      <dc:date>2017-06-27T19:00:49Z</dc:date>
    </item>
  </channel>
</rss>

