<?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: Place value in custom column if date is a certain month? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Place-value-in-custom-column-if-date-is-a-certain-month/m-p/310492#M93116</link>
    <description>&lt;P&gt;That worked, thank you!&lt;/P&gt;</description>
    <pubDate>Mon, 02 Apr 2018 17:35:15 GMT</pubDate>
    <dc:creator>rkassabov</dc:creator>
    <dc:date>2018-04-02T17:35:15Z</dc:date>
    <item>
      <title>Place value in custom column if date is a certain month?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Place-value-in-custom-column-if-date-is-a-certain-month/m-p/310485#M93109</link>
      <description>&lt;P&gt;I am trying to populate a custom column if a date stamp (that has been converted to epoch) if that date stamp matches to a certain month, like so:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval month=strftime("Step Date Completed","%b")
| eval January=case(month=="jan",winRate)
| eval February=case(month=="feb",winRate)
| eval March=case(month=="mar",winRate)
| eval April=case(month=="apr",winRate)
| eval May=case(month=="may",winRate)
| eval June=case(month=="jun",winRate)
| eval July=case(month=="jul",winRate)
| eval August=case(month=="aug",winRate)
| eval September=case(month=="sept",winRate)
| eval October=case(month=="oct",winRate)
| eval November=case(month=="nov",winRate)
| eval December=case(month=="dec",winRate)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;However, that doesn't seem to be working. How would I accomplish this? Note, each month above corresponds to a custom column.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Apr 2018 16:41:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Place-value-in-custom-column-if-date-is-a-certain-month/m-p/310485#M93109</guid>
      <dc:creator>rkassabov</dc:creator>
      <dc:date>2018-04-02T16:41:23Z</dc:date>
    </item>
    <item>
      <title>Re: Place value in custom column if date is a certain month?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Place-value-in-custom-column-if-date-is-a-certain-month/m-p/310486#M93110</link>
      <description>&lt;P&gt;Well , first of all %b returns stuff like this -   %b=Abbreviated month name. (Jan, Feb, etc.) &lt;BR /&gt;
You are doing exact string matching,, jan is not equal to Jan.&lt;/P&gt;

&lt;P&gt;Try changing your first letters after == to caps.&lt;BR /&gt;
Second, i don't think you need == a single = should work.&lt;BR /&gt;
If you are still not getting the results, i would like to see samples of your Step Date Completed field&lt;/P&gt;</description>
      <pubDate>Mon, 02 Apr 2018 16:50:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Place-value-in-custom-column-if-date-is-a-certain-month/m-p/310486#M93110</guid>
      <dc:creator>Sukisen1981</dc:creator>
      <dc:date>2018-04-02T16:50:55Z</dc:date>
    </item>
    <item>
      <title>Re: Place value in custom column if date is a certain month?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Place-value-in-custom-column-if-date-is-a-certain-month/m-p/310487#M93111</link>
      <description>&lt;P&gt;Two minor revisions might make the difference. First, you'll need to use single quotes around the field name &lt;CODE&gt;'Step Date Completed'&lt;/CODE&gt;, or else the strftime function is going to try to evaluate against the literal string &lt;CODE&gt;Step Date Completed&lt;/CODE&gt;. Second, the matches in your month checks will be case-sensitive, and Splunk is going to return month names with the first letter capitalized. Give this a try:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval month=strftime('Step Date Completed',"%b")
| eval January=case(month=="Jan",winRate)
| eval February=case(month=="Feb",winRate)
| eval March=case(month=="Mar",winRate)
| eval April=case(month=="Apr",winRate)
| eval May=case(month=="May",winRate)
| eval June=case(month=="Jun",winRate)
| eval July=case(month=="Jul",winRate)
| eval August=case(month=="Aug",winRate)
| eval September=case(month=="Sept",winRate)
| eval October=case(month=="Oct",winRate)
| eval November=case(month=="Nov",winRate)
| eval December=case(month=="Dec",winRate)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 02 Apr 2018 16:54:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Place-value-in-custom-column-if-date-is-a-certain-month/m-p/310487#M93111</guid>
      <dc:creator>elliotproebstel</dc:creator>
      <dc:date>2018-04-02T16:54:30Z</dc:date>
    </item>
    <item>
      <title>Re: Place value in custom column if date is a certain month?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Place-value-in-custom-column-if-date-is-a-certain-month/m-p/310488#M93112</link>
      <description>&lt;P&gt;No luck, for reference here is what my date stamps look like before converting to epoch (step date completed): 2018-02-22 21:54:00.380000&lt;/P&gt;</description>
      <pubDate>Mon, 02 Apr 2018 17:14:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Place-value-in-custom-column-if-date-is-a-certain-month/m-p/310488#M93112</guid>
      <dc:creator>rkassabov</dc:creator>
      <dc:date>2018-04-02T17:14:10Z</dc:date>
    </item>
    <item>
      <title>Re: Place value in custom column if date is a certain month?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Place-value-in-custom-column-if-date-is-a-certain-month/m-p/310489#M93113</link>
      <description>&lt;P&gt;No luck, for reference here is what my date stamps look like before converting to epoch (step date completed): 2018-02-22 21:54:00.380000 &lt;/P&gt;</description>
      <pubDate>Mon, 02 Apr 2018 17:14:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Place-value-in-custom-column-if-date-is-a-certain-month/m-p/310489#M93113</guid>
      <dc:creator>rkassabov</dc:creator>
      <dc:date>2018-04-02T17:14:35Z</dc:date>
    </item>
    <item>
      <title>Re: Place value in custom column if date is a certain month?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Place-value-in-custom-column-if-date-is-a-certain-month/m-p/310490#M93114</link>
      <description>&lt;P&gt;Can you run this and tell me the output:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search that creates the field `Step Date Completed` as an epoch time
| eval month=strftime('Step Date Completed',"%b")
| table 'Step Date Completed' month
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I can help troubleshoot with that.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Apr 2018 17:26:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Place-value-in-custom-column-if-date-is-a-certain-month/m-p/310490#M93114</guid>
      <dc:creator>elliotproebstel</dc:creator>
      <dc:date>2018-04-02T17:26:00Z</dc:date>
    </item>
    <item>
      <title>Re: Place value in custom column if date is a certain month?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Place-value-in-custom-column-if-date-is-a-certain-month/m-p/310491#M93115</link>
      <description>&lt;P&gt;Based on your comments, you need to convert to epoch and then to a string with month. The format of your date field looks to be a string, not epoch. Also, try an if statement. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval month=strftime(strptime('Step Date Completed',"%Y-%m-%d %H:%M:%S.%6N"),"%b")
 | eval January=if(month="Jan",winRate,null())
 | eval February=if(month="Feb",winRate,null())
 | eval March=if(month="Mar",winRate,null())
 | eval April=if(month="Apr",winRate,null())
 | eval May=if(month="May",winRate,null())
 | eval June=if(month="Jun",winRate,null())
 | eval July=if(month="Jul",winRate,null())
 | eval August=if(month="Aug",winRate,null())
 | eval September=if(month="Sept",winRate,null())
 | eval October=if(month="Oct",winRate,null())
 | eval November=if(month="Nov",winRate,null())
 | eval December=if(month="Dec",winRate,null())
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 02 Apr 2018 17:28:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Place-value-in-custom-column-if-date-is-a-certain-month/m-p/310491#M93115</guid>
      <dc:creator>cmerriman</dc:creator>
      <dc:date>2018-04-02T17:28:54Z</dc:date>
    </item>
    <item>
      <title>Re: Place value in custom column if date is a certain month?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Place-value-in-custom-column-if-date-is-a-certain-month/m-p/310492#M93116</link>
      <description>&lt;P&gt;That worked, thank you!&lt;/P&gt;</description>
      <pubDate>Mon, 02 Apr 2018 17:35:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Place-value-in-custom-column-if-date-is-a-certain-month/m-p/310492#M93116</guid>
      <dc:creator>rkassabov</dc:creator>
      <dc:date>2018-04-02T17:35:15Z</dc:date>
    </item>
  </channel>
</rss>

