<?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 create a new field out of some evaluated data? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-new-field-out-of-some-evaluated-data/m-p/424045#M172706</link>
    <description>&lt;P&gt;Sure, so the field: message.concurrent_sessions has different values in it which tell us the number of concurrent sessions. An image of which is below: &lt;BR /&gt;
&lt;A href="https://drive.google.com/open?id=1L-6q9Mlg5yrrZCWlc2xF8J0R523lqyro" target="_blank"&gt;https://drive.google.com/open?id=1L-6q9Mlg5yrrZCWlc2xF8J0R523lqyro&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;As shown in the query,  I'm doing stats sum(message.concurrent_sessions)  and renaming the resulting tabular column as "Concurrent Sessions". But instead of just a tabular column, I want a whole new field which has the resulting values (that Concurrent Sessions has) in it.&lt;/P&gt;

&lt;P&gt;I know it's stats sum(eval(condition)), but no matter what I try, Splunk says it's an error. Need to frame it right.&lt;/P&gt;

&lt;P&gt;Here's the raw text of one log:&lt;BR /&gt;
&lt;STRONG&gt;{"message": {"account": "fox_nation", "title": "Fox News Talk Radio | Public", "timestamp": 1549440027975, "channelID": "f12a9d64997042498dbb8cbe1560355d", "missing_content_slate": 2, "concurrent_sessions": 2}}&lt;/STRONG&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 23:35:08 GMT</pubDate>
    <dc:creator>moizmmz</dc:creator>
    <dc:date>2020-09-29T23:35:08Z</dc:date>
    <item>
      <title>How to create a new field out of some evaluated data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-new-field-out-of-some-evaluated-data/m-p/424043#M172704</link>
      <description>&lt;P&gt;Hello, &lt;/P&gt;

&lt;P&gt;So here's my Query:&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;index=video-eng-live | rename message.timestamp as time  | eval time=strftime(time/1000, "%m-%d-%Y %H:%M:%S") | dedup message.concurrent_sessions, time | stats sum(message.concurrent_sessions) as "Concurrent Sessions" by message.account | addcoltotals labelfield=message.account label="Total"&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;After I calculate the 'sum(message.concurrent_sessions)' I want to make a new field called 'Concurrent Sessions' out of it. How could I do that? I suppose it would have to be a combination of stats and eval but I just can't seem to get it right. Please help!&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 23:35:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-new-field-out-of-some-evaluated-data/m-p/424043#M172704</guid>
      <dc:creator>moizmmz</dc:creator>
      <dc:date>2020-09-29T23:35:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a new field out of some evaluated data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-new-field-out-of-some-evaluated-data/m-p/424044#M172705</link>
      <description>&lt;P&gt;Hi dyude @moizmmz , &lt;/P&gt;

&lt;P&gt;Could you please explain more a bit about it so that we can have a clear picture or can you share some sample logs?&lt;/P&gt;

&lt;P&gt;I think you are looking for something like this... &lt;/P&gt;

&lt;P&gt;Your search | stats count(eval(  &lt;CODE&gt;Your Condtion&lt;/CODE&gt; )) as test by message.account&lt;/P&gt;</description>
      <pubDate>Wed, 06 Mar 2019 17:58:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-new-field-out-of-some-evaluated-data/m-p/424044#M172705</guid>
      <dc:creator>vinod94</dc:creator>
      <dc:date>2019-03-06T17:58:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a new field out of some evaluated data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-new-field-out-of-some-evaluated-data/m-p/424045#M172706</link>
      <description>&lt;P&gt;Sure, so the field: message.concurrent_sessions has different values in it which tell us the number of concurrent sessions. An image of which is below: &lt;BR /&gt;
&lt;A href="https://drive.google.com/open?id=1L-6q9Mlg5yrrZCWlc2xF8J0R523lqyro" target="_blank"&gt;https://drive.google.com/open?id=1L-6q9Mlg5yrrZCWlc2xF8J0R523lqyro&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;As shown in the query,  I'm doing stats sum(message.concurrent_sessions)  and renaming the resulting tabular column as "Concurrent Sessions". But instead of just a tabular column, I want a whole new field which has the resulting values (that Concurrent Sessions has) in it.&lt;/P&gt;

&lt;P&gt;I know it's stats sum(eval(condition)), but no matter what I try, Splunk says it's an error. Need to frame it right.&lt;/P&gt;

&lt;P&gt;Here's the raw text of one log:&lt;BR /&gt;
&lt;STRONG&gt;{"message": {"account": "fox_nation", "title": "Fox News Talk Radio | Public", "timestamp": 1549440027975, "channelID": "f12a9d64997042498dbb8cbe1560355d", "missing_content_slate": 2, "concurrent_sessions": 2}}&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 23:35:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-new-field-out-of-some-evaluated-data/m-p/424045#M172706</guid>
      <dc:creator>moizmmz</dc:creator>
      <dc:date>2020-09-29T23:35:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a new field out of some evaluated data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-new-field-out-of-some-evaluated-data/m-p/424046#M172707</link>
      <description>&lt;P&gt;@moizmmz ,&lt;/P&gt;

&lt;P&gt;Try this ,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=video-eng-live | rename message.timestamp as time | eval time=strftime(time/1000, "%m-%d-%Y %H:%M:%S") | dedup message.concurrent_sessions, time | eventstats sum(message.concurrent_sessions) as "New Concurrent Sessions" by message.account |
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and check the fields .. der should be a "New Concurrent Sessions" field&lt;/P&gt;

&lt;P&gt;Let me know if it works! &lt;/P&gt;</description>
      <pubDate>Wed, 06 Mar 2019 18:44:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-new-field-out-of-some-evaluated-data/m-p/424046#M172707</guid>
      <dc:creator>vinod94</dc:creator>
      <dc:date>2019-03-06T18:44:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a new field out of some evaluated data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-new-field-out-of-some-evaluated-data/m-p/424047#M172708</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/145620"&gt;@moizmmz&lt;/a&gt; &lt;BR /&gt;
try this: I think for this scenario you may have to use eventstats. It will calculate the sum of concurrent sessions by account into a new field as you require. Hope it helps&lt;/P&gt;

&lt;P&gt;index=video-eng-live | rename message.timestamp as time | eval time=strftime(time/1000, "%m-%d-%Y %H:%M:%S") | dedup message.concurrent_sessions, time | eventstats sum(message.concurrent_sessions) as "Concurrent Sessions" by message.account | addcoltotals labelfield=message.account label="Total"&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 23:30:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-new-field-out-of-some-evaluated-data/m-p/424047#M172708</guid>
      <dc:creator>cvssravan</dc:creator>
      <dc:date>2020-09-29T23:30:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a new field out of some evaluated data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-new-field-out-of-some-evaluated-data/m-p/424048#M172709</link>
      <description>&lt;P&gt;Perfect!! Thank you!!!&lt;/P&gt;</description>
      <pubDate>Wed, 06 Mar 2019 19:10:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-new-field-out-of-some-evaluated-data/m-p/424048#M172709</guid>
      <dc:creator>moizmmz</dc:creator>
      <dc:date>2019-03-06T19:10:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a new field out of some evaluated data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-new-field-out-of-some-evaluated-data/m-p/424049#M172710</link>
      <description>&lt;P&gt;Perfect! Thank you!&lt;/P&gt;</description>
      <pubDate>Wed, 06 Mar 2019 19:10:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-new-field-out-of-some-evaluated-data/m-p/424049#M172710</guid>
      <dc:creator>moizmmz</dc:creator>
      <dc:date>2019-03-06T19:10:45Z</dc:date>
    </item>
  </channel>
</rss>

