<?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: Specify field delimiter for Powershell input in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Specify-field-delimiter-for-Powershell-input/m-p/189541#M37760</link>
    <description>&lt;P&gt;Yeah, that is the part that was missing (for me) in the example.  I didn't see how the files were related/linked.&lt;/P&gt;

&lt;P&gt;I only have access to the server being monitored.  I can only make changes to the universal forwarder.  From what I understand, to use what you suggested needs to happen on a search head?  Is that correct?&lt;/P&gt;

&lt;P&gt;I do have control over the PS1 script.  I like not using a transforms.conf idea better.  I tried key=value pairs.  But same issue.  What is the syntax?  &lt;/P&gt;

&lt;P&gt;Here is sample output to PowerShell console:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host=server1|ip=10.1.1.100|status=Online|uptime=156.1:10:26|sql=DEFAULT|sqlService=MSSQLSERVER|sqlStatus=Running|sqlUptime=156.1:8:45
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Here is how that looks in splunk search (its taking each record and making two events now, was one event before.  either way, missing same data):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host=server1|IP=10.1.1.100|Status=Online|Uptime=.::|
sql=|sqlService=|sqlStatus=|sqlUptime=.::
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Here is the PS1 code that assigns all my variables to one and then prints it.  How can splunk see 'sql=' and 'sqlUptime='  but not the variable value??  It works to console and to file.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;$toSplunk="host=$hostname|IP=$ipAddress|Status=$hostStatus|Uptime=$hostUptime|sql=$instanceName|sqlService=$serviceName|sqlStatus=$serviceStatus|sqlUptime=$sqlUptime"
$toSplunk
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 21 Mar 2014 21:15:04 GMT</pubDate>
    <dc:creator>axo959</dc:creator>
    <dc:date>2014-03-21T21:15:04Z</dc:date>
    <item>
      <title>Specify field delimiter for Powershell input</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Specify-field-delimiter-for-Powershell-input/m-p/189535#M37754</link>
      <description>&lt;P&gt;I have the following entry in my local input.conf file.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[script://.\bin\execPS.cmd zDBA_AAG_Server.ps1]
source = Powershell
sourcetype = testType
interval = 10
index = mssql
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The contents of the batch wrapper execPS.cmd file:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;@ECHO OFF
SET MYSPLUNKAPP=Splunk_TA_windows
SET SPLUNK_HOME="C:\Program Files\SplunkUniversalForwarder"
Powershell -command ". '%SPLUNK_HOME%\etc\apps\%MYSPLUNKAPP%\bin\powershell\%1'"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The output is 7 fields and pipe delimited.  Which Splunk figures out the first half of each event/row/record.  The fourth (and seventh) field has d.hh:mm:ss and I think this throws Splunk off because when I search the index, the events have no data in fields 4-7.  Just the pipes.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Server01|10.10.1.10|Windows 2012|.::||||.::
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;How do I explicitly define the pipe char as the field delimiter?&lt;/P&gt;

&lt;P&gt;I've tried these two entries in the transforms.conf file, but neither seemed to work.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[Powershell]
DELIMS="|"
FIELDS="Col1","Col2","Col3","Col4","Col5","Col6","Col7"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[testType]
DELIMS="|"
FIELDS="Col1","Col2","Col3","Col4","Col5","Col6","Col7"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 14 Mar 2014 22:11:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Specify-field-delimiter-for-Powershell-input/m-p/189535#M37754</guid>
      <dc:creator>axo959</dc:creator>
      <dc:date>2014-03-14T22:11:59Z</dc:date>
    </item>
    <item>
      <title>Re: Specify field delimiter for Powershell input</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Specify-field-delimiter-for-Powershell-input/m-p/189536#M37755</link>
      <description>&lt;P&gt;i doubt the scripts returning any value.. execute it amnually or have a txt output in local dir to see the output.&lt;/P&gt;</description>
      <pubDate>Fri, 14 Mar 2014 22:57:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Specify-field-delimiter-for-Powershell-input/m-p/189536#M37755</guid>
      <dc:creator>linu1988</dc:creator>
      <dc:date>2014-03-14T22:57:40Z</dc:date>
    </item>
    <item>
      <title>Re: Specify field delimiter for Powershell input</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Specify-field-delimiter-for-Powershell-input/m-p/189537#M37756</link>
      <description>&lt;P&gt;You'll need to reference these transforms in props.conf.  Check out REPORT-&lt;CLASS&gt; in the &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.0.2/Admin/Propsconf"&gt;props.conf doc&lt;/A&gt; for details.&lt;/CLASS&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 15 Mar 2014 16:54:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Specify-field-delimiter-for-Powershell-input/m-p/189537#M37756</guid>
      <dc:creator>sbrant_splunk</dc:creator>
      <dc:date>2014-03-15T16:54:46Z</dc:date>
    </item>
    <item>
      <title>Re: Specify field delimiter for Powershell input</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Specify-field-delimiter-for-Powershell-input/m-p/189538#M37757</link>
      <description>&lt;P&gt;The script outputs to console or file if redirected.&lt;/P&gt;

&lt;P&gt;I don't want to redirect stdout to a file just to ingest that.  I'd like to avoid writing to disk twice.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Mar 2014 16:40:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Specify-field-delimiter-for-Powershell-input/m-p/189538#M37757</guid>
      <dc:creator>axo959</dc:creator>
      <dc:date>2014-03-18T16:40:44Z</dc:date>
    </item>
    <item>
      <title>Re: Specify field delimiter for Powershell input</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Specify-field-delimiter-for-Powershell-input/m-p/189539#M37758</link>
      <description>&lt;P&gt;I was looking at a db input example to try to understand how the inputs.conf, props.conf and transforms.conf files work together.  Obviously my input is different because its a powershell script.&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.0.2/AdvancedDev/ScriptSetup"&gt;http://docs.splunk.com/Documentation/Splunk/6.0.2/AdvancedDev/ScriptSetup&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;From the example, I don't see how the 3 files are related.  It looks like the fields are defined in the transforms.conf file.  I did not see any attributes in the props.conf documentation that seemed related to defining fields.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;From the doc:&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;Configure scripted data input in $SPLUNK_HOME/etc/&lt;APPNAME&gt;/default/inputs.conf. Use the local directory for the app to overwrite behavior defined in the default directory. Here is an example: &lt;/APPNAME&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[script://$SPLUNK_HOME/etc/apps/&amp;lt;appName&amp;gt;/bin/starter_script.sh]
disabled = true # change to false to start the input, requires restart
host = # enter hostname here
index = main
interval = 30    #frequency to run the script, in seconds
source = my_db
sourcetype = my_db_data
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;$SPLUNK_HOME/etc/system/local/props.conf &lt;BR /&gt;
Configure properties for the script in the Splunk system props.conf: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[my_db]
TIME_PREFIX=^[^\|]+\|
TIME_FORMAT=%Q
MAX_TIMESTAMP_LOOKAHEAD=10  #look ahead 10 characters
SHOULD_LINEMERGE=false
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;$SPLUNK_HOME/etc/system/local/transforms.conf &lt;BR /&gt;
Define field transforms in transforms.conf: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[my_db_extractions]
DELIMS = "|"
FIELDS ="EventID","AlertTime","UserName",. . ."
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 18 Mar 2014 17:06:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Specify-field-delimiter-for-Powershell-input/m-p/189539#M37758</guid>
      <dc:creator>axo959</dc:creator>
      <dc:date>2014-03-18T17:06:05Z</dc:date>
    </item>
    <item>
      <title>Re: Specify field delimiter for Powershell input</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Specify-field-delimiter-for-Powershell-input/m-p/189540#M37759</link>
      <description>&lt;P&gt;The props.conf example, that you're showing here, only includes what I would refer to as onboarding config (pre-index).  That is linebreaking, date/time extraction, time format, etc.  There are also search-time configurations that go into props.conf, such as EXTRACT, where you can specify a regex right in the props file.&lt;/P&gt;

&lt;P&gt;You can also reference configurations that reside in transforms.conf, such as with REPORT.  My point with the original post is that just having a transforms.conf file doesn't do anything, you have to reference the configs that reside in it from props.conf.&lt;/P&gt;

&lt;P&gt;Example:&lt;/P&gt;

&lt;P&gt;--- props.conf ---&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[my_db]
REPORT-db_extractions = my_db_extractions
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;--- transforms.conf ---&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[my_db_extractions]
DELIMS = "|"
FIELDS ="EventID","AlertTime","UserName",. . ."
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Another thing to consider, if you have control over the powershell script, is to output the results of the powershell script in key=value pairs.  Splunk will automatically extract key=value pairs.  This is more dynamic, in the event that the number of fields changes in your output.  No transforms.conf necessary.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Mar 2014 22:08:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Specify-field-delimiter-for-Powershell-input/m-p/189540#M37759</guid>
      <dc:creator>sbrant_splunk</dc:creator>
      <dc:date>2014-03-19T22:08:35Z</dc:date>
    </item>
    <item>
      <title>Re: Specify field delimiter for Powershell input</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Specify-field-delimiter-for-Powershell-input/m-p/189541#M37760</link>
      <description>&lt;P&gt;Yeah, that is the part that was missing (for me) in the example.  I didn't see how the files were related/linked.&lt;/P&gt;

&lt;P&gt;I only have access to the server being monitored.  I can only make changes to the universal forwarder.  From what I understand, to use what you suggested needs to happen on a search head?  Is that correct?&lt;/P&gt;

&lt;P&gt;I do have control over the PS1 script.  I like not using a transforms.conf idea better.  I tried key=value pairs.  But same issue.  What is the syntax?  &lt;/P&gt;

&lt;P&gt;Here is sample output to PowerShell console:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host=server1|ip=10.1.1.100|status=Online|uptime=156.1:10:26|sql=DEFAULT|sqlService=MSSQLSERVER|sqlStatus=Running|sqlUptime=156.1:8:45
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Here is how that looks in splunk search (its taking each record and making two events now, was one event before.  either way, missing same data):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host=server1|IP=10.1.1.100|Status=Online|Uptime=.::|
sql=|sqlService=|sqlStatus=|sqlUptime=.::
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Here is the PS1 code that assigns all my variables to one and then prints it.  How can splunk see 'sql=' and 'sqlUptime='  but not the variable value??  It works to console and to file.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;$toSplunk="host=$hostname|IP=$ipAddress|Status=$hostStatus|Uptime=$hostUptime|sql=$instanceName|sqlService=$serviceName|sqlStatus=$serviceStatus|sqlUptime=$sqlUptime"
$toSplunk
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 21 Mar 2014 21:15:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Specify-field-delimiter-for-Powershell-input/m-p/189541#M37760</guid>
      <dc:creator>axo959</dc:creator>
      <dc:date>2014-03-21T21:15:04Z</dc:date>
    </item>
    <item>
      <title>Re: Specify field delimiter for Powershell input</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Specify-field-delimiter-for-Powershell-input/m-p/189542#M37761</link>
      <description>&lt;P&gt;The props/transforms would go on the search head for field extractions but you wouldn't need that if going the key=value route.&lt;/P&gt;

&lt;P&gt;Can you modify your script to place the values in quotes?  so, for instance,  sqlUptime="156.1:8:45"&lt;/P&gt;</description>
      <pubDate>Fri, 21 Mar 2014 21:54:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Specify-field-delimiter-for-Powershell-input/m-p/189542#M37761</guid>
      <dc:creator>sbrant_splunk</dc:creator>
      <dc:date>2014-03-21T21:54:59Z</dc:date>
    </item>
    <item>
      <title>Re: Specify field delimiter for Powershell input</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Specify-field-delimiter-for-Powershell-input/m-p/189543#M37762</link>
      <description>&lt;P&gt;Still wont show the key-value pairs' value&lt;BR /&gt;
(just listing last two columms)&lt;/P&gt;

&lt;P&gt;PS1 stdout using comma separated list of columns&lt;BR /&gt;
sqlStatus="Running",sqlUptime="158.16:52:6"&lt;/P&gt;

&lt;P&gt;Splunk search looks like&lt;BR /&gt;
sqlStatus="",sqlUptime=".::"&lt;/P&gt;

&lt;P&gt;PS1 stdout using comma and space-char&lt;BR /&gt;
sqlStatus="Running",sqlUptime="158.16:55:2"&lt;/P&gt;

&lt;P&gt;Splunk search looks like&lt;BR /&gt;
sqlStatus="", sqlUptime=".::"&lt;/P&gt;</description>
      <pubDate>Mon, 24 Mar 2014 20:33:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Specify-field-delimiter-for-Powershell-input/m-p/189543#M37762</guid>
      <dc:creator>axo959</dc:creator>
      <dc:date>2014-03-24T20:33:30Z</dc:date>
    </item>
  </channel>
</rss>

