<?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: transforms ,tsv input, taking each log entry and distributing it across days in that month in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/transforms-tsv-input-taking-each-log-entry-and-distributing-it/m-p/420289#M74012</link>
    <description>&lt;P&gt;Yes bingo, thank you! this works as part of a search. But I was wondering if there was something similar in a transform to push my data through when loading it. This works great for a search, and again thank you for that, but was just wondering if there was something similar at load time. I'd run a different process on the 1st of the month vs the rest of the month to break this out.. &lt;/P&gt;</description>
    <pubDate>Wed, 23 Jan 2019 19:55:30 GMT</pubDate>
    <dc:creator>tmblue</dc:creator>
    <dc:date>2019-01-23T19:55:30Z</dc:date>
    <item>
      <title>transforms ,tsv input, taking each log entry and distributing it across days in that month</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/transforms-tsv-input-taking-each-log-entry-and-distributing-it/m-p/420281#M74004</link>
      <description>&lt;P&gt;I'm not sure if it's possible.  I know I can limit, and I know I can play some regex on the input. But has anyone done, or seen where someone took an accumulative sum and spread it evenly across the 28/30/31 days in a month?&lt;/P&gt;

&lt;P&gt;Say you have the value 4123.902992 in a log file. it arrives on the 1st of every month (it's a default spend) (note you will be adding smaller sized spend daily, but you have sunk costs which is that number referenced.&lt;/P&gt;

&lt;P&gt;Just not sure if Splunk has something like this vs me breaking it out before I give it to Splunk, It's possible, but before doing so, I wanted to see if I could get creative with Splunk and be able to reuse for future type events?&lt;/P&gt;</description>
      <pubDate>Mon, 21 Jan 2019 23:20:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/transforms-tsv-input-taking-each-log-entry-and-distributing-it/m-p/420281#M74004</guid>
      <dc:creator>tmblue</dc:creator>
      <dc:date>2019-01-21T23:20:30Z</dc:date>
    </item>
    <item>
      <title>Re: transforms ,tsv input, taking each log entry and distributing it across days in that month</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/transforms-tsv-input-taking-each-log-entry-and-distributing-it/m-p/420282#M74005</link>
      <description>&lt;P&gt;@tmblue ,&lt;BR /&gt;
Try ,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|makeresults |eval sum=4123.902992
|fields _time,sum
|eval earliest=relative_time(_time,"-1mon@mon")| eval latest=relative_time(_time,"@mon")|eval diff=round((latest-earliest)/86400,0)
|eval days=strftime(mvrange(earliest,latest,"1d"),"%Y-%m-%d")|mvexpand days
|eval perday=sum/diff|table days,perday
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;First line should be changed to your &lt;STRONG&gt;event time(_time)&lt;/STRONG&gt; and &lt;STRONG&gt;sum&lt;/STRONG&gt; value field. This should give you the distribution across days for previous month i.e. you are executing the search in &lt;STRONG&gt;Jan&lt;/STRONG&gt; and you want the distribution across &lt;STRONG&gt;Dec&lt;/STRONG&gt;.&lt;/P&gt;

&lt;P&gt;Change earliest and latest to below (3rd line) if you are looking for current month, i.e. you are executing the search in &lt;STRONG&gt;Jan&lt;/STRONG&gt; and you want the distribution across &lt;STRONG&gt;Jan&lt;/STRONG&gt;.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|eval earliest=relative_time(_time,"@mon")| eval latest=relative_time(_time,"+1mon@mon")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 22 Jan 2019 06:27:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/transforms-tsv-input-taking-each-log-entry-and-distributing-it/m-p/420282#M74005</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2019-01-22T06:27:26Z</dc:date>
    </item>
    <item>
      <title>Re: transforms ,tsv input, taking each log entry and distributing it across days in that month</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/transforms-tsv-input-taking-each-log-entry-and-distributing-it/m-p/420283#M74006</link>
      <description>&lt;P&gt;Hi @tmblue,&lt;/P&gt;

&lt;P&gt;Did you have a chance to check out renjith.nair 's answer? If it worked, please resolve this post by approving it! If your problem is still not solved, keep us updated so that someone else can help ya. &lt;/P&gt;</description>
      <pubDate>Tue, 22 Jan 2019 22:52:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/transforms-tsv-input-taking-each-log-entry-and-distributing-it/m-p/420283#M74006</guid>
      <dc:creator>mstjohn_splunk</dc:creator>
      <dc:date>2019-01-22T22:52:44Z</dc:date>
    </item>
    <item>
      <title>Re: transforms ,tsv input, taking each log entry and distributing it across days in that month</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/transforms-tsv-input-taking-each-log-entry-and-distributing-it/m-p/420284#M74007</link>
      <description>&lt;P&gt;Yep, sorry working on it now. trying to tweak it to see if I can get it to work. &lt;/P&gt;</description>
      <pubDate>Tue, 22 Jan 2019 23:05:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/transforms-tsv-input-taking-each-log-entry-and-distributing-it/m-p/420284#M74007</guid>
      <dc:creator>tmblue</dc:creator>
      <dc:date>2019-01-22T23:05:47Z</dc:date>
    </item>
    <item>
      <title>Re: transforms ,tsv input, taking each log entry and distributing it across days in that month</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/transforms-tsv-input-taking-each-log-entry-and-distributing-it/m-p/420285#M74008</link>
      <description>&lt;P&gt;Sorry still playing with this. As written I get something like 40K results,, and it should be just 28/30/31 depending on the month. Still working, tweaking to see if it's something I'm doing.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jan 2019 23:07:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/transforms-tsv-input-taking-each-log-entry-and-distributing-it/m-p/420285#M74008</guid>
      <dc:creator>tmblue</dc:creator>
      <dc:date>2019-01-22T23:07:21Z</dc:date>
    </item>
    <item>
      <title>Re: transforms ,tsv input, taking each log entry and distributing it across days in that month</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/transforms-tsv-input-taking-each-log-entry-and-distributing-it/m-p/420286#M74009</link>
      <description>&lt;P&gt;I'm not getting it, as written above I'm getting an error. it's the first value after index=xxx| &lt;/P&gt;

&lt;P&gt;| makeresults |eval sum=4123.902992&lt;BR /&gt;
 |fields TimePeriod,Cost ; _time would work fine here as well, _time and TimePeriod (field) are identical&lt;BR /&gt;
 |eval earliest=relative_time(_time,"@mon")| eval latest=relative_time(_time,"+1mon@mon")|eval diff=round((latest-earliest)/86400,0)&lt;BR /&gt;
 |eval days=strftime(mvrange(earliest,latest,"1d"),"%Y-%m-%d")|mvexpand days&lt;BR /&gt;
 |eval perday=sum/diff|table days,perday &lt;/P&gt;

&lt;P&gt;Error in 'makeresults' command: This command must be the first command of a search.&lt;/P&gt;

&lt;P&gt;Was trying to tweak it (I've never used makeresults), but not getting anywhere.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 22:54:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/transforms-tsv-input-taking-each-log-entry-and-distributing-it/m-p/420286#M74009</guid>
      <dc:creator>tmblue</dc:creator>
      <dc:date>2020-09-29T22:54:40Z</dc:date>
    </item>
    <item>
      <title>Re: transforms ,tsv input, taking each log entry and distributing it across days in that month</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/transforms-tsv-input-taking-each-log-entry-and-distributing-it/m-p/420287#M74010</link>
      <description>&lt;P&gt;@tmblue , when you are using index=x, you need to remove &lt;CODE&gt;makeresults&lt;/CODE&gt;. It was just to create a dummy row.&lt;BR /&gt;
So for you it will be&lt;/P&gt;

&lt;P&gt;The above should give you a single row with a _time and Cost value based on the time range you selected. &lt;/P&gt;

&lt;P&gt;Once you verify above add the rest of the search without the makeresults line to that  , ie.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    index="your index" "select the date to reflect the month you are looking for" 
    |stats first(_time) as _time,first(Cost) as Cost
    |eval earliest=relative_time(_time,"@mon")| eval latest=relative_time(_time,"+1mon@mon")|eval diff=round((latest-earliest)/86400,0)
    |eval days=strftime(mvrange(earliest,latest,"1d"),"%Y-%m-%d")|mvexpand days
    |eval perday=Cost/diff|table days,perday
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 23 Jan 2019 04:07:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/transforms-tsv-input-taking-each-log-entry-and-distributing-it/m-p/420287#M74010</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2019-01-23T04:07:02Z</dc:date>
    </item>
    <item>
      <title>Re: transforms ,tsv input, taking each log entry and distributing it across days in that month</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/transforms-tsv-input-taking-each-log-entry-and-distributing-it/m-p/420288#M74011</link>
      <description>&lt;P&gt;oops, okay testing now, since makeresults was an actual command, I thought that was what was being required. I did try without it before and that is when I got the 10-40K results &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; I'm testing again.. thanks !&lt;/P&gt;</description>
      <pubDate>Wed, 23 Jan 2019 19:52:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/transforms-tsv-input-taking-each-log-entry-and-distributing-it/m-p/420288#M74011</guid>
      <dc:creator>tmblue</dc:creator>
      <dc:date>2019-01-23T19:52:57Z</dc:date>
    </item>
    <item>
      <title>Re: transforms ,tsv input, taking each log entry and distributing it across days in that month</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/transforms-tsv-input-taking-each-log-entry-and-distributing-it/m-p/420289#M74012</link>
      <description>&lt;P&gt;Yes bingo, thank you! this works as part of a search. But I was wondering if there was something similar in a transform to push my data through when loading it. This works great for a search, and again thank you for that, but was just wondering if there was something similar at load time. I'd run a different process on the 1st of the month vs the rest of the month to break this out.. &lt;/P&gt;</description>
      <pubDate>Wed, 23 Jan 2019 19:55:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/transforms-tsv-input-taking-each-log-entry-and-distributing-it/m-p/420289#M74012</guid>
      <dc:creator>tmblue</dc:creator>
      <dc:date>2019-01-23T19:55:30Z</dc:date>
    </item>
    <item>
      <title>Re: transforms ,tsv input, taking each log entry and distributing it across days in that month</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/transforms-tsv-input-taking-each-log-entry-and-distributing-it/m-p/420290#M74013</link>
      <description>&lt;P&gt;I am not sure how useful it is to put in configuration but you could add this to your props &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[your sourcetype name]
EVAL-PerDayValue = Cost/round((relative_time(_time,"+1mon@mon")-relative_time(_time,"@mon"))/86400,0)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This will create &lt;CODE&gt;PerDayValue&lt;/CODE&gt; field in the event where there is &lt;CODE&gt;Cost&lt;/CODE&gt; field&lt;/P&gt;</description>
      <pubDate>Thu, 24 Jan 2019 05:58:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/transforms-tsv-input-taking-each-log-entry-and-distributing-it/m-p/420290#M74013</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2019-01-24T05:58:30Z</dc:date>
    </item>
  </channel>
</rss>

