<?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: How to use split to extract a delimited value? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-split-to-extract-a-delimited-value/m-p/141502#M39205</link>
    <description>&lt;P&gt;I think I was off on the mvindex command.  Try 6 instead of 7.  To verify your work, replace the timechart command with &lt;CODE&gt;table _raw, num&lt;/CODE&gt;.  If the data displayed is what you expected then put the timechart back.&lt;/P&gt;</description>
    <pubDate>Mon, 14 Jul 2014 17:34:53 GMT</pubDate>
    <dc:creator>richgalloway</dc:creator>
    <dc:date>2014-07-14T17:34:53Z</dc:date>
    <item>
      <title>How to use split to extract a delimited value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-split-to-extract-a-delimited-value/m-p/141496#M39199</link>
      <description>&lt;P&gt;I'd like to be able to extract a numerical field from a delimited log entry, and then create a graph of that number over time. I am trying to extract the colon (:) delimited field directly before "USERS" (2nd field from the end) in the log entries below:&lt;/P&gt;

&lt;P&gt;14-07-13 12:54:00.096 STATS: maint.47CMri_3.47CMri_3.: 224: UC.v1:7:USERS&lt;/P&gt;

&lt;P&gt;14-07-12 02:53:59.250 STATS: maint.47BMrr_3.47BMrr_3.: 64: UC.v1:12:USERS&lt;/P&gt;

&lt;P&gt;I have tried to use regex to extract this value without success. Like 99.999% of the people on this planet, I am not a regex expert. I did try the regex extraction apps. Now I see that split() may do this but can't find documentation that really explains how to put the resulting fields into variables that can be piped into timechart. Is there a splunk analog of the Unix "cut" command?&lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 17:03:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-split-to-extract-a-delimited-value/m-p/141496#M39199</guid>
      <dc:creator>wbeaucha</dc:creator>
      <dc:date>2020-09-28T17:03:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to use split to extract a delimited value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-split-to-extract-a-delimited-value/m-p/141497#M39200</link>
      <description>&lt;P&gt;Are you trying to extract numbers 7 and 12 from your example logs? Is the keyword USERS constant in value and/or in its position?&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jul 2014 16:00:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-split-to-extract-a-delimited-value/m-p/141497#M39200</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2014-07-14T16:00:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to use split to extract a delimited value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-split-to-extract-a-delimited-value/m-p/141498#M39201</link>
      <description>&lt;P&gt;Something like this should do the job.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your search | eval fields=split(_raw,":") | eval num=mvindex(fields,7) | ...
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If you want to do it using regex, then this string should get you what you want.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your search | rex ":(?&amp;lt;num&amp;gt;\d+):USERS" | ...
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 14 Jul 2014 16:05:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-split-to-extract-a-delimited-value/m-p/141498#M39201</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2014-07-14T16:05:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to use split to extract a delimited value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-split-to-extract-a-delimited-value/m-p/141499#M39202</link>
      <description>&lt;P&gt;Yes, I'm trying to extract numbers 7 and 12 from the example logs and the keyword USERS is always the last field in this log entry.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jul 2014 16:11:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-split-to-extract-a-delimited-value/m-p/141499#M39202</guid>
      <dc:creator>wbeaucha</dc:creator>
      <dc:date>2014-07-14T16:11:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to use split to extract a delimited value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-split-to-extract-a-delimited-value/m-p/141500#M39203</link>
      <description>&lt;P&gt;Searches provided by @richgalloway should work to get that [assuming, no of colons are always 7 (for split) and "USERS" is the hard-coded string (for rex)].&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jul 2014 17:11:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-split-to-extract-a-delimited-value/m-p/141500#M39203</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2014-07-14T17:11:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to use split to extract a delimited value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-split-to-extract-a-delimited-value/m-p/141501#M39204</link>
      <description>&lt;P&gt;Thanks richgalloway. Cool, now we are getting somewhere. Using the command below I see the values(num) showing up in statistics by day, but the graph in Visualization is only showing the vertices, and no plot line. &lt;/P&gt;

&lt;P&gt;source="/logpath/logfile.log" earliest=-7d@d latest=@d :USERS  | eval fields=split(_raw,":")  | eval num=mvindex(fields,7)  | timechart values(num)&lt;/P&gt;

&lt;P&gt;Am I doing something wrong?&lt;/P&gt;

&lt;P&gt;Thanks, &lt;BR /&gt;
Warren&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jul 2014 17:11:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-split-to-extract-a-delimited-value/m-p/141501#M39204</guid>
      <dc:creator>wbeaucha</dc:creator>
      <dc:date>2014-07-14T17:11:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to use split to extract a delimited value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-split-to-extract-a-delimited-value/m-p/141502#M39205</link>
      <description>&lt;P&gt;I think I was off on the mvindex command.  Try 6 instead of 7.  To verify your work, replace the timechart command with &lt;CODE&gt;table _raw, num&lt;/CODE&gt;.  If the data displayed is what you expected then put the timechart back.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jul 2014 17:34:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-split-to-extract-a-delimited-value/m-p/141502#M39205</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2014-07-14T17:34:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to use split to extract a delimited value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-split-to-extract-a-delimited-value/m-p/141503#M39206</link>
      <description>&lt;P&gt;Once you fix the mvindex, ensure that you've set the following property for the chart. Default value is "gaps" and that's why you just see the vertices.&lt;/P&gt;

&lt;P&gt;charting.chart.nullValueMode=connect&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jul 2014 17:40:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-split-to-extract-a-delimited-value/m-p/141503#M39206</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2014-07-14T17:40:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to use split to extract a delimited value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-split-to-extract-a-delimited-value/m-p/141504#M39207</link>
      <description>&lt;P&gt;Yes I am using field number 6. Sorry that was not reflected in the cut and paste.&lt;/P&gt;

&lt;P&gt;source="/logpath/logfile.log" earliest=-7d@d latest=@d :USERS  | eval fields=split(_raw,":")  | eval num=mvindex(fields,6)  | timechart values(num)&lt;/P&gt;

&lt;P&gt;I edited the chart format via the format drop down and changed the null values to connect, but that did not change anything, graph still shows no data.  I notice that in statistics, each date _time single value has many values(num) associated with it.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jul 2014 20:51:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-split-to-extract-a-delimited-value/m-p/141504#M39207</guid>
      <dc:creator>wbeaucha</dc:creator>
      <dc:date>2014-07-14T20:51:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to use split to extract a delimited value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-split-to-extract-a-delimited-value/m-p/141505#M39208</link>
      <description>&lt;P&gt;What is this num field anyways (what value it holds) and what do you want to chart on (max, avg)? Timechart values(num) basically give you a multivalued fields with list of unique values at a given time span. You should use some aggregate command for the graph. You want to plot all the values for num in the graph??&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jul 2014 21:11:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-split-to-extract-a-delimited-value/m-p/141505#M39208</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2014-07-14T21:11:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to use split to extract a delimited value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-split-to-extract-a-delimited-value/m-p/141506#M39209</link>
      <description>&lt;P&gt;The num field contains the number of users logged into our app at the point in time when the log entry was created. I want a graph showing number of users logged in vs time. Yes, I'd like to plot all the values for num in the graph. Thanks again!&lt;/P&gt;</description>
      <pubDate>Tue, 15 Jul 2014 14:40:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-split-to-extract-a-delimited-value/m-p/141506#M39209</guid>
      <dc:creator>wbeaucha</dc:creator>
      <dc:date>2014-07-15T14:40:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to use split to extract a delimited value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-split-to-extract-a-delimited-value/m-p/141507#M39210</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="/logpath/logfile.log" earliest=-7d@d latest=@d :USERS | eval fields=split(_raw,":") | eval num=mvindex(fields,6) | timechart sum(num) as loggedUsers
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 15 Jul 2014 14:55:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-split-to-extract-a-delimited-value/m-p/141507#M39210</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2014-07-15T14:55:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to use split to extract a delimited value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-split-to-extract-a-delimited-value/m-p/141508#M39211</link>
      <description>&lt;P&gt;That's much closer. I changed it to just show the past day below.&lt;/P&gt;

&lt;P&gt;source="/logpath/logfile.log" earliest=-1d@d latest=@d :USERS | eval fields=split(_raw,":") | eval num=mvindex(fields,6) | timechart sum(num) as loggedUsers&lt;/P&gt;

&lt;P&gt;I now get a graph line showing the number of users that looks closer to reality, but it looks like it is summing the  numbers every 30 minutes? I'm looking for a graph showing the actual data.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Jul 2014 15:40:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-split-to-extract-a-delimited-value/m-p/141508#M39211</guid>
      <dc:creator>wbeaucha</dc:creator>
      <dc:date>2014-07-15T15:40:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to use split to extract a delimited value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-split-to-extract-a-delimited-value/m-p/141509#M39212</link>
      <description>&lt;P&gt;Ok, I think I have something that works without breaking the flash chart's 10000 line max. I had to add an option to change the timespan that it was summing to 5 minutes. I'm not sure why I have to sum at all, but whatever, the graph is displaying the right data now. &lt;/P&gt;

&lt;P&gt;source="/logpath/logfile.log" earliest=-7d@d latest=@d :USERS | eval fields=split(_raw,":") | eval num=mvindex(fields,6) | timechart span=5m sum(num) as loggedUsers &lt;/P&gt;

&lt;P&gt;Thanks again!&lt;/P&gt;</description>
      <pubDate>Tue, 15 Jul 2014 15:58:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-split-to-extract-a-delimited-value/m-p/141509#M39212</guid>
      <dc:creator>wbeaucha</dc:creator>
      <dc:date>2014-07-15T15:58:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to use split to extract a delimited value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-split-to-extract-a-delimited-value/m-p/141510#M39213</link>
      <description>&lt;P&gt;The timechart span is breaking events in 5 min set (events happened on 10:00 to 10:05 will be grouped together) so a sum is required in case there are multiple entries in one set. If you're sure that there won't be multiple entries in 5 min period, your can change sum with max/min/first/last.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Jul 2014 16:14:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-split-to-extract-a-delimited-value/m-p/141510#M39213</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2014-07-15T16:14:49Z</dc:date>
    </item>
  </channel>
</rss>

