<?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: Field Does Not Exist in Tstats in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-add-a-non-existing-field-in-tstats-command/m-p/592570#M206252</link>
    <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/121880"&gt;@whitefang1726&lt;/a&gt;&amp;nbsp;- It depends. If all the fields you need are indexed fields then yes you can do it.&lt;/P&gt;&lt;P&gt;For example, you just need to count by new_field extracted from source then you can use something like below query:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| tstats count where index=something sourcetype=something:something by source
| rex field=source ".....(?&amp;lt;new_field&amp;gt;[0-9A-Z]+)"
| stats sum(count) as count by new_field&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope this helps!!&lt;/P&gt;</description>
    <pubDate>Wed, 06 Apr 2022 05:55:39 GMT</pubDate>
    <dc:creator>VatsalJagani</dc:creator>
    <dc:date>2022-04-06T05:55:39Z</dc:date>
    <item>
      <title>How to add a non existing field in tstats command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-add-a-non-existing-field-in-tstats-command/m-p/592550#M206241</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I looking for options to add a non-existing field in tstats command. The scenario is the field doesn't exist. Normally I create regex for searches, however, it doesn't work similar with tstats.&lt;/P&gt;
&lt;P&gt;Example Query:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index=something sourcetype=something:something
| rex field=source".....(?&amp;lt;new_field&amp;gt;[0-9A-Z]+)"

&lt;/LI-CODE&gt;
&lt;P&gt;This command will create &lt;STRONG&gt;new_field&amp;nbsp;&lt;/STRONG&gt; field based on &lt;STRONG&gt;source&lt;/STRONG&gt; field.&lt;/P&gt;
&lt;P&gt;For tstats, the idea should be..&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;| tstats count max(_time) as _time where ....&lt;/LI-CODE&gt;
&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is this possible? Sorry for the lack of details.&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Apr 2022 15:28:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-add-a-non-existing-field-in-tstats-command/m-p/592550#M206241</guid>
      <dc:creator>whitefang1726</dc:creator>
      <dc:date>2022-04-06T15:28:08Z</dc:date>
    </item>
    <item>
      <title>Re: Field Does Not Exist in Tstats</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-add-a-non-existing-field-in-tstats-command/m-p/592556#M206244</link>
      <description>&lt;P&gt;tstats only for indexed fields. rex is a search-time.&lt;/P&gt;&lt;P&gt;Refer -&amp;nbsp;&lt;A href="https://docs.splunk.com/Documentation/Splunk/8.2.5/Data/Configureindex-timefieldextraction" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/8.2.5/Data/Configureindex-timefieldextraction&lt;/A&gt;&lt;/P&gt;&lt;P&gt;after successful creation you can use the field in tstats.&lt;/P&gt;&lt;P&gt;--&lt;/P&gt;&lt;P&gt;Hope it helps!&lt;/P&gt;</description>
      <pubDate>Wed, 06 Apr 2022 03:22:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-add-a-non-existing-field-in-tstats-command/m-p/592556#M206244</guid>
      <dc:creator>venkatasri</dc:creator>
      <dc:date>2022-04-06T03:22:11Z</dc:date>
    </item>
    <item>
      <title>Re: Field Does Not Exist in Tstats</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-add-a-non-existing-field-in-tstats-command/m-p/592570#M206252</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/121880"&gt;@whitefang1726&lt;/a&gt;&amp;nbsp;- It depends. If all the fields you need are indexed fields then yes you can do it.&lt;/P&gt;&lt;P&gt;For example, you just need to count by new_field extracted from source then you can use something like below query:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| tstats count where index=something sourcetype=something:something by source
| rex field=source ".....(?&amp;lt;new_field&amp;gt;[0-9A-Z]+)"
| stats sum(count) as count by new_field&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope this helps!!&lt;/P&gt;</description>
      <pubDate>Wed, 06 Apr 2022 05:55:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-add-a-non-existing-field-in-tstats-command/m-p/592570#M206252</guid>
      <dc:creator>VatsalJagani</dc:creator>
      <dc:date>2022-04-06T05:55:39Z</dc:date>
    </item>
  </channel>
</rss>

