<?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: Best method to export data and send data from an unlicensed deployment server in Reporting</title>
    <link>https://community.splunk.com/t5/Reporting/Best-method-to-export-data-and-send-data-from-an-unlicensed/m-p/480096#M7713</link>
    <description>&lt;P&gt;Sure.  I'm sure splunk, like other vendors requires you to have good standing in "the community" to maintain their stupid gamification society (possibly even affecting your ability to get certain certs).  I'll accept your answer no problem!&lt;/P&gt;</description>
    <pubDate>Thu, 12 Sep 2019 17:25:18 GMT</pubDate>
    <dc:creator>mbrownoutside</dc:creator>
    <dc:date>2019-09-12T17:25:18Z</dc:date>
    <item>
      <title>Best method to export data and send data from an unlicensed deployment server</title>
      <link>https://community.splunk.com/t5/Reporting/Best-method-to-export-data-and-send-data-from-an-unlicensed/m-p/480089#M7706</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I have a challenge where I'd like to export the following data from a deployment server to a file that can be ingested with a inputs.conf monitor stanza so that I can provide my team with visibility into new deployment server clients.&lt;/P&gt;

&lt;P&gt;In our case, we have an app inclusive of client scope &lt;CODE&gt;*&lt;/CODE&gt;  deploying a &lt;CODE&gt;deploymentclient.conf&lt;/CODE&gt;.  Therefore, any client that has an application count of &lt;CODE&gt;1&lt;/CODE&gt; means that it can be considered "unmanaged" and needs remediation.&lt;/P&gt;

&lt;P&gt;Since we are utilizing splunkcloud, I run an on-site deployment server that I can better regulate than the SH instances managed in the cloud.&lt;/P&gt;

&lt;P&gt;The technicals of the challenge:&lt;/P&gt;

&lt;P&gt;I could use &lt;CODE&gt;outputcsv&lt;/CODE&gt;, and perform field extraction, but I feel like that's complex.  What I was hoping to do was use&lt;CODE&gt;outputcsv usexml=true&lt;/CODE&gt;.  But, because I want to make the system accessible in a semi-centralized fashion, I wish to schedule the query as an alert to run daily.  It explicitly states in the docs on &lt;CODE&gt;outputcsv&lt;/CODE&gt; that &lt;CODE&gt;usexml&lt;/CODE&gt; is not valid when used in the "UI."  This is quite clear given that the results... are  &lt;EM&gt;not&lt;/EM&gt; entered in XML, but, as expected, in CSV.&lt;/P&gt;

&lt;P&gt;So, I'm sort of stuck as to how to get this data fired into the ingestion pipeline to be indexed with fields extracted.  I know that &lt;CODE&gt;splunkd&lt;/CODE&gt; would automatically perform index time field extraction on properly formatted XML, as well as lines of text in a "key=value" format.&lt;/P&gt;

&lt;P&gt;Oh... you just came here for the query and are going to run it with &lt;CODE&gt;cron&lt;/CODE&gt; using the &lt;CODE&gt;splunk search ...&lt;/CODE&gt; command invocation?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rest /services/deployment/server/clients splunk_server=local 
| eval hostinfo=hostname."#".ip."#".utsname 
| table hostinfo applications*.stateOnClient 
| untable hostinfo applications value 
| eval applications=replace(applications,"applications\.(\w+)\.stateOnClient","\1") 
| search 
    [| rest /services/deployment/server/clients splunk_server=local 
    | eval hostinfo=hostname."#".ip."#".utsname 
    | table hostinfo applications*.stateOnClient 
    | untable hostinfo applications value 
    | eval applications=replace(applications,"applications\.(\w+)\.stateOnClient","\1") 
    | stats count(value) as ct by hostinfo 
    | search ct=1 
    | fields hostinfo ] 
| rex field=hostinfo "^(?&amp;lt;hostname&amp;gt;.*)#(?&amp;lt;ip&amp;gt;.*)#(?&amp;lt;uts&amp;gt;.*)$" 
| fields - _* 
| fields hostname ip uts applications value | outputcsv singlefile=true create_empty=true usexml=true newish_deployment_clients
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I included &lt;CODE&gt;ip&lt;/CODE&gt; and &lt;CODE&gt;uts&lt;/CODE&gt; to provide some context for which server-classes to add the client.&lt;/P&gt;

&lt;P&gt;I guess I just revealed that I feel like it probably will work if I invoke from CLI with &lt;CODE&gt;splunk search&lt;/CODE&gt;, I just don't want to do that so if I get hit by the proverbial bus, a layman can understand how to resolve any issues within the web UI on the deployment server.&lt;/P&gt;

&lt;P&gt;Fine.  I'll try it anyway.&lt;/P&gt;

&lt;P&gt;But I'd really like to know for this use case, as well as others that may come up, how to save search output to the file system of a heavy forwarder or SH or deployment server via UI driven search?&lt;/P&gt;

&lt;P&gt;If anyone can assist, I'd appreciate it.&lt;/P&gt;

&lt;P&gt;Thanks,&lt;/P&gt;

&lt;P&gt;Matt&lt;/P&gt;</description>
      <pubDate>Wed, 11 Sep 2019 21:08:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/Best-method-to-export-data-and-send-data-from-an-unlicensed/m-p/480089#M7706</guid>
      <dc:creator>mbrownoutside</dc:creator>
      <dc:date>2019-09-11T21:08:46Z</dc:date>
    </item>
    <item>
      <title>Re: Best method to export data and send data from an unlicensed deployment server</title>
      <link>https://community.splunk.com/t5/Reporting/Best-method-to-export-data-and-send-data-from-an-unlicensed/m-p/480090#M7707</link>
      <description>&lt;P&gt;Hi mbrownoutside,&lt;BR /&gt;
I did something like you to display Deployment Servers configurations (we had 2 DSs).&lt;BR /&gt;
I scheduled an dayly alert on each DS with outputcsv at the end of the search that was writing on a file in $SPLUNK_HOME/var/run/splunk/csv and I configured an input to ingest those files.&lt;BR /&gt;
Probably the most rows of your output.csv will be the same every time, so it's better to insert the date in the outputcsv name (e.g. DS_Monitoring_2019-09-12) and use &lt;CODE&gt;cscSal=&amp;lt;SOURCE&amp;gt;&lt;/CODE&gt; option in inputs.conf.&lt;/P&gt;

&lt;P&gt;So your search will be:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your_search
| outputcsv [search * | head 1 | eval query="DS_Monitoring_".strftime(now(),"%Y-%m-%d") | fields query | format "" "" "" "" "" ""]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And your inpouts.conf will be:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[monitor:///opt/splunk/var/run/splunk/csv/DS_Monitoring_*]
index=your_index
sourcetype=your_sourcetype
cscSal=&amp;lt;SOURCE&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 02:07:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/Best-method-to-export-data-and-send-data-from-an-unlicensed/m-p/480090#M7707</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2020-09-30T02:07:14Z</dc:date>
    </item>
    <item>
      <title>Re: Best method to export data and send data from an unlicensed deployment server</title>
      <link>https://community.splunk.com/t5/Reporting/Best-method-to-export-data-and-send-data-from-an-unlicensed/m-p/480091#M7708</link>
      <description>&lt;P&gt;Thank you for the additional input.  Thanks for pointing out the &lt;CODE&gt;cscSal&lt;/CODE&gt; inputs parameter.  However, it appears you were answering another concern.&lt;/P&gt;

&lt;P&gt;My problem is having the data export in a way that will provide field extraction when cooked as is.  Meaning, I will not need to write transforms and props for the sourcetype.&lt;/P&gt;

&lt;P&gt;The two ways I know of to do this are to deliver data into a file formatted as:&lt;BR /&gt;
* XML&lt;BR /&gt;
* key=value&lt;/P&gt;

&lt;P&gt;I can't do this with &lt;CODE&gt;outputcsv&lt;/CODE&gt;, unless I totally misunderstand?&lt;/P&gt;

&lt;P&gt;If I use &lt;CODE&gt;outputscsv&lt;/CODE&gt;, it appears that &lt;CODE&gt;usexml=true&lt;/CODE&gt; does not enforce exporting XML; CSV is exported, and when I tail that file for ingestion with &lt;CODE&gt;inputs.conf/monitor&lt;/CODE&gt;, the entire file is ingested as a single event and no fields are extracted.&lt;/P&gt;

&lt;P&gt;I probably can just lookup field extracting CSVs, and this will solve my problem.  However, any specific input on this challenge would be helpful.&lt;/P&gt;

&lt;P&gt;Thanks,&lt;/P&gt;

&lt;P&gt;Matt&lt;/P&gt;

&lt;P&gt;[update]&lt;BR /&gt;
Yes, apparently I'm being lazy.  See my answer.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Sep 2019 12:42:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/Best-method-to-export-data-and-send-data-from-an-unlicensed/m-p/480091#M7708</guid>
      <dc:creator>mbrownoutside</dc:creator>
      <dc:date>2019-09-12T12:42:57Z</dc:date>
    </item>
    <item>
      <title>Re: Best method to export data and send data from an unlicensed deployment server</title>
      <link>https://community.splunk.com/t5/Reporting/Best-method-to-export-data-and-send-data-from-an-unlicensed/m-p/480092#M7709</link>
      <description>&lt;P&gt;Yes, so I must configure a field extraction:&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/Data/Extractfieldsfromfileswithstructureddata"&gt;https://docs.splunk.com/Documentation/Splunk/latest/Data/Extractfieldsfromfileswithstructureddata&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;Simple example: &lt;A href="https://answers.splunk.com/answers/29418/step-by-step-adding-a-new-csv-datasource.html"&gt;https://answers.splunk.com/answers/29418/step-by-step-adding-a-new-csv-datasource.html&lt;/A&gt;&lt;/LI&gt;
&lt;/UL&gt;</description>
      <pubDate>Thu, 12 Sep 2019 13:07:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/Best-method-to-export-data-and-send-data-from-an-unlicensed/m-p/480092#M7709</guid>
      <dc:creator>mbrownoutside</dc:creator>
      <dc:date>2019-09-12T13:07:09Z</dc:date>
    </item>
    <item>
      <title>Re: Best method to export data and send data from an unlicensed deployment server</title>
      <link>https://community.splunk.com/t5/Reporting/Best-method-to-export-data-and-send-data-from-an-unlicensed/m-p/480093#M7710</link>
      <description>&lt;P&gt;Sorry, I misunderstood!&lt;BR /&gt;
I use csv and I have no problems.&lt;BR /&gt;
Anyway it isn't possible to export in XML using outputcsv, but you could use REST API.&lt;BR /&gt;
There are useful information at &lt;A href="https://answers.splunk.com/answers/33418/export-splunk-results-to-an-xml-output.html"&gt;https://answers.splunk.com/answers/33418/export-splunk-results-to-an-xml-output.html&lt;/A&gt; and &lt;A href="https://answers.splunk.com/answers/13739/output-xml-via-a-custom-search-command.html"&gt;https://answers.splunk.com/answers/13739/output-xml-via-a-custom-search-command.html&lt;/A&gt; .&lt;/P&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Thu, 12 Sep 2019 13:59:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/Best-method-to-export-data-and-send-data-from-an-unlicensed/m-p/480093#M7710</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2019-09-12T13:59:16Z</dc:date>
    </item>
    <item>
      <title>Re: Best method to export data and send data from an unlicensed deployment server</title>
      <link>https://community.splunk.com/t5/Reporting/Best-method-to-export-data-and-send-data-from-an-unlicensed/m-p/480094#M7711</link>
      <description>&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Thu, 12 Sep 2019 17:19:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/Best-method-to-export-data-and-send-data-from-an-unlicensed/m-p/480094#M7711</guid>
      <dc:creator>mbrownoutside</dc:creator>
      <dc:date>2019-09-12T17:19:48Z</dc:date>
    </item>
    <item>
      <title>Re: Best method to export data and send data from an unlicensed deployment server</title>
      <link>https://community.splunk.com/t5/Reporting/Best-method-to-export-data-and-send-data-from-an-unlicensed/m-p/480095#M7712</link>
      <description>&lt;P&gt;Hi mbrownoutside,,&lt;BR /&gt;
if my answer satisfied your question, please accept and/or upvote it.&lt;BR /&gt;
Thank You and see you next time.&lt;BR /&gt;
Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Thu, 12 Sep 2019 17:23:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/Best-method-to-export-data-and-send-data-from-an-unlicensed/m-p/480095#M7712</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2019-09-12T17:23:05Z</dc:date>
    </item>
    <item>
      <title>Re: Best method to export data and send data from an unlicensed deployment server</title>
      <link>https://community.splunk.com/t5/Reporting/Best-method-to-export-data-and-send-data-from-an-unlicensed/m-p/480096#M7713</link>
      <description>&lt;P&gt;Sure.  I'm sure splunk, like other vendors requires you to have good standing in "the community" to maintain their stupid gamification society (possibly even affecting your ability to get certain certs).  I'll accept your answer no problem!&lt;/P&gt;</description>
      <pubDate>Thu, 12 Sep 2019 17:25:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/Best-method-to-export-data-and-send-data-from-an-unlicensed/m-p/480096#M7713</guid>
      <dc:creator>mbrownoutside</dc:creator>
      <dc:date>2019-09-12T17:25:18Z</dc:date>
    </item>
  </channel>
</rss>

