<?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: Outputlookup followed by stats command causes extra column to be generated in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Outputlookup-followed-by-stats-command-causes-extra-column-to-be/m-p/755564#M242947</link>
    <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/310918"&gt;@Anders333&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The lookup file is created with the fields _time and test, then you run stats values(test) as testing. This produces a new field testing in the search results.&lt;BR /&gt;Splunk lookup files are schema‑flexible. If later commands introduce new fields, splunk adds them as new columns, even if they’re empty for existing rows.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;If you need only testing field then write your outputlookup command after your stats.&lt;BR /&gt;Eg:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| eval test = "this is a testing thing"

| stats values(test) as testing | outputlookup append=false test.csv&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Prewin&lt;BR /&gt;&lt;span class="lia-unicode-emoji" title=":glowing_star:"&gt;🌟&lt;/span&gt;If this answer helped you, please consider marking it as the solution or giving a Karma. Thanks!&lt;/P&gt;</description>
    <pubDate>Mon, 17 Nov 2025 04:44:32 GMT</pubDate>
    <dc:creator>PrewinThomas</dc:creator>
    <dc:date>2025-11-17T04:44:32Z</dc:date>
    <item>
      <title>Outputlookup followed by stats command causes extra column to be generated</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Outputlookup-followed-by-stats-command-causes-extra-column-to-be/m-p/755510#M242943</link>
      <description>&lt;P&gt;Hello, I came across some unexpected search behaviour today.&lt;/P&gt;&lt;P&gt;When using the outputlookup command followed by a stats command, as in the example, an additional empty column is added to the lookup file.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| eval test = "this is a testing thing"
| outputlookup append=false testindjiasbhd8a0.csv
| stats values(test) as testing&lt;/LI-CODE&gt;&lt;P&gt;Expected lookup table:&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="50%"&gt;_time&lt;/TD&gt;&lt;TD width="50%"&gt;&lt;P&gt;test&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%"&gt;2025-11-14 14:19:07&lt;/TD&gt;&lt;TD width="50%"&gt;this is a testing thing&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;Actual lookup table:&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;_time&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;test&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;testing&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%"&gt;2025-11-14 14:19:07&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;this is a testing thing&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't know if this is a bug or expected behaviour., and I was unable to find anything that would explain it.&lt;/P&gt;&lt;P&gt;Thanks &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Nov 2025 13:29:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Outputlookup-followed-by-stats-command-causes-extra-column-to-be/m-p/755510#M242943</guid>
      <dc:creator>Anders333</dc:creator>
      <dc:date>2025-11-14T13:29:26Z</dc:date>
    </item>
    <item>
      <title>Re: Outputlookup followed by stats command causes extra column to be generated</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Outputlookup-followed-by-stats-command-causes-extra-column-to-be/m-p/755534#M242944</link>
      <description>&lt;P&gt;My understanding is that as part of the search processing, the processor determines which fields are required at the end and those are then available to be output by the outputlookup command. It doesn't have to be a stats command or even a field with any values. For example, a similar result will be shown if you try this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| eval test = "this is a testing thing"
| outputlookup append=false testindjiasbhd8a0.csv
| table testing&lt;/LI-CODE&gt;&lt;P&gt;However, you can work around this by removing the field before it is created&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| eval test = "this is a testing thing"
| fields - testing
| outputlookup append=false testindjiasbhd8a0.csv
| stats values(test) as testing&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 14 Nov 2025 23:18:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Outputlookup-followed-by-stats-command-causes-extra-column-to-be/m-p/755534#M242944</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2025-11-14T23:18:59Z</dc:date>
    </item>
    <item>
      <title>Re: Outputlookup followed by stats command causes extra column to be generated</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Outputlookup-followed-by-stats-command-causes-extra-column-to-be/m-p/755564#M242947</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/310918"&gt;@Anders333&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The lookup file is created with the fields _time and test, then you run stats values(test) as testing. This produces a new field testing in the search results.&lt;BR /&gt;Splunk lookup files are schema‑flexible. If later commands introduce new fields, splunk adds them as new columns, even if they’re empty for existing rows.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;If you need only testing field then write your outputlookup command after your stats.&lt;BR /&gt;Eg:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| eval test = "this is a testing thing"

| stats values(test) as testing | outputlookup append=false test.csv&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Prewin&lt;BR /&gt;&lt;span class="lia-unicode-emoji" title=":glowing_star:"&gt;🌟&lt;/span&gt;If this answer helped you, please consider marking it as the solution or giving a Karma. Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 17 Nov 2025 04:44:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Outputlookup-followed-by-stats-command-causes-extra-column-to-be/m-p/755564#M242947</guid>
      <dc:creator>PrewinThomas</dc:creator>
      <dc:date>2025-11-17T04:44:32Z</dc:date>
    </item>
  </channel>
</rss>

