<?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: Why is Powershell Scripted Input via Universal Forwarder Not being Indexed? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Why-is-powershell-scripted-Input-via-universal-forwarder-not/m-p/604034#M105066</link>
    <description>&lt;P&gt;I've tried adding a timestamp to the PSObject and also without adding one (note the function in the above script is not ever called but is a good example of how I'd be adding that timestamp).&amp;nbsp;&lt;/P&gt;&lt;P&gt;The index they're (supposed to be) going to doesn't show the event even if searching all time.&amp;nbsp; That index does not regularly receive events so there's very little data there.&amp;nbsp; A real-time search on that index also does not show the events as they're arriving.&lt;/P&gt;</description>
    <pubDate>Thu, 30 Jun 2022 20:25:14 GMT</pubDate>
    <dc:creator>wsgr_mccurity</dc:creator>
    <dc:date>2022-06-30T20:25:14Z</dc:date>
    <item>
      <title>Why is powershell scripted Input via universal forwarder not being indexed?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Why-is-powershell-scripted-Input-via-universal-forwarder-not/m-p/601093#M104739</link>
      <description>&lt;P&gt;The below setup doesn't appear to index the script's output and I can't figure out why.&amp;nbsp; Even the basic one-liner example in their documentation (&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/Data/MonitorWindowsdatawithPowerShellscripts" target="_blank" rel="noopener"&gt;https://docs.splunk.com/Documentation/Splunk/latest/Data/MonitorWindowsdatawithPowerShellscripts&lt;/A&gt;) doesn't produce indexed events for me.&amp;nbsp; I've tried several variations on how the data is being formatted.&amp;nbsp; I know the script executes because the file change it makes is occurring.&lt;/P&gt;
&lt;P&gt;configureBINDIP.ps1&lt;/P&gt;
&lt;PRE&gt;$launchConfFile = "C:\Program Files\SplunkUniversalForwarder\etc\splunk-launch.conf"&lt;BR /&gt;$launchConfSetting = "SPLUNK_BINDIP=127.0.0.1"&lt;BR /&gt;&lt;BR /&gt;function CraftEvent ($message) {&lt;BR /&gt;  $event = [PSCustomObject]@{&lt;BR /&gt;    "SplunkIndex" = "windows"&lt;BR /&gt;    "SplunkSource" = "powershell"&lt;BR /&gt;    "SplunkSourceType" = "Powershell:ConfigureBINDIP"&lt;BR /&gt;    "SplunkHost" = "mysplunkhost"&lt;BR /&gt;    "SplunkTime" = (New-TimeSpan -Start $(Get-Date -Date "01/01/1970") -End $(Get-Date)).TotalSeconds&lt;BR /&gt;    "Message" = $message&lt;BR /&gt;  }&lt;BR /&gt;&lt;BR /&gt;  Return $event&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;if (-not (Test-Path $launchConfFile) ) {&lt;BR /&gt;  $event = [PSCustomObject]@{&lt;BR /&gt;    "Message" = "Could not locate splunk-launch.conf: $launchConfFile"&lt;BR /&gt;  }&lt;BR /&gt;  Write-Output $event | Select-Object&lt;BR /&gt;  exit&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;if ( (Get-Content $launchConfFile ) -notcontains $launchConfSetting ) {&lt;BR /&gt;  $message = "Appending '$launchConfSetting' to '$launchConfFile'"&lt;BR /&gt;  "`r`n$launchConfSetting" | Out-File $launchConfFile -Append utf8&lt;BR /&gt;&lt;BR /&gt;  if ( (Get-Content $launchConfFile ) -contains $launchConfSetting ) {&lt;BR /&gt;    $message += ".... splunk-launch.conf update successful. Please remove this host from the app to restart."&lt;BR /&gt;  } else {&lt;BR /&gt;    $message += ".... splunk-launch.conf does not appear updated. Please continue to monitor."&lt;BR /&gt;  }&lt;BR /&gt;} else {&lt;BR /&gt;  $message = "splunk-launch.conf already appears updated. Please remove this host from the app to restart."&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;$event = [PSCustomObject]@{&lt;BR /&gt;"Message" = $message&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;Write-Output $event | Select-Object&lt;/PRE&gt;
&lt;P&gt;inputs.conf&lt;/P&gt;
&lt;PRE&gt;[powershell://ConfigureBINDIP]&lt;BR /&gt;script = . "$SplunkHome\etc\apps\configure_bindip\bin\configureBINDIP.ps1"&lt;BR /&gt;index = windows&lt;BR /&gt;source = powershell&lt;BR /&gt;sourcetype = Powershell:ConfigureBINDIP&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;web.conf&lt;/P&gt;
&lt;PRE&gt;[settings]&lt;BR /&gt;mgmtHostPort = 127.0.0.1:8089&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jun 2022 21:17:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Why-is-powershell-scripted-Input-via-universal-forwarder-not/m-p/601093#M104739</guid>
      <dc:creator>wsgr_mccurity</dc:creator>
      <dc:date>2022-06-30T21:17:41Z</dc:date>
    </item>
    <item>
      <title>Re: Powershell Scripted Input via Universal Forwarder Not being Indexed</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Why-is-powershell-scripted-Input-via-universal-forwarder-not/m-p/601112#M104745</link>
      <description>&lt;P&gt;Check the splunk-powershell.log&lt;/P&gt;&lt;P&gt;The script might be starting but failing in the middle somewhere.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jun 2022 06:08:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Why-is-powershell-scripted-Input-via-universal-forwarder-not/m-p/601112#M104745</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2022-06-09T06:08:16Z</dc:date>
    </item>
    <item>
      <title>Re: Powershell Scripted Input via Universal Forwarder Not being Indexed</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Why-is-powershell-scripted-Input-via-universal-forwarder-not/m-p/601188#M104766</link>
      <description>&lt;P&gt;I don't see anything unusual in there.&amp;nbsp; Only three entries per run: Queued, Start execution, and End execution.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jun 2022 13:11:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Why-is-powershell-scripted-Input-via-universal-forwarder-not/m-p/601188#M104766</guid>
      <dc:creator>wsgr_mccurity</dc:creator>
      <dc:date>2022-06-09T13:11:59Z</dc:date>
    </item>
    <item>
      <title>Re: Why is Powershell Scripted Input via Universal Forwarder Not being Indexed?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Why-is-powershell-scripted-Input-via-universal-forwarder-not/m-p/601509#M104802</link>
      <description>&lt;P&gt;You can check your _internal logs from that forwarder whether any events were produced.&lt;/P&gt;&lt;P&gt;Something like that&lt;/P&gt;&lt;PRE&gt;index=_internal sourcetype=splunkd host=&amp;lt;your_forwarder&amp;gt; component=Metrics group=per_source_thruput series=powershell*&lt;/PRE&gt;</description>
      <pubDate>Mon, 13 Jun 2022 10:03:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Why-is-powershell-scripted-Input-via-universal-forwarder-not/m-p/601509#M104802</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2022-06-13T10:03:45Z</dc:date>
    </item>
    <item>
      <title>Re: Why is Powershell Scripted Input via Universal Forwarder Not being Indexed?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Why-is-powershell-scripted-Input-via-universal-forwarder-not/m-p/601607#M104811</link>
      <description>&lt;P&gt;I don't see any events with the powershell* series.&lt;BR /&gt;&lt;BR /&gt;EDIT - I see them for splunk-powershell*.&amp;nbsp; FWIW to help expedite testing I cranked up the schedule to every minute, the metrics in this log represent that and not the default "run once" schedule.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;06-13-2022 11:32:08.790 -0700 INFO  Metrics - group=per_sourcetype_thruput, series="splunk-powershell.ps-2", kbps=0.014, eps=0.097, kb=0.419, ev=3, avg_age=0.000, max_age=0
06-13-2022 11:31:06.774 -0700 INFO  Metrics - group=per_sourcetype_thruput, series="splunk-powershell.ps-2", kbps=0.014, eps=0.097, kb=0.420, ev=3, avg_age=0.000, max_age=0
06-13-2022 11:30:04.767 -0700 INFO  Metrics - group=per_sourcetype_thruput, series="splunk-powershell.ps-2", kbps=0.014, eps=0.097, kb=0.420, ev=3, avg_age=20.000, max_age=60
06-13-2022 11:29:33.765 -0700 INFO  Metrics - group=per_sourcetype_thruput, series="splunk-powershell.ps-2", kbps=0.000, eps=0.032, kb=0.000, ev=1, avg_age=0.000, max_age=0&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jun 2022 18:35:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Why-is-powershell-scripted-Input-via-universal-forwarder-not/m-p/601607#M104811</guid>
      <dc:creator>wsgr_mccurity</dc:creator>
      <dc:date>2022-06-13T18:35:04Z</dc:date>
    </item>
    <item>
      <title>Re: Why is Powershell Scripted Input via Universal Forwarder Not being Indexed?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Why-is-powershell-scripted-Input-via-universal-forwarder-not/m-p/601613#M104812</link>
      <description>&lt;P&gt;Hmm... indeed seems that your script does generate events.&lt;/P&gt;&lt;P&gt;Do you generate timestamp with your events? You might be hitting the "no timestamp so splunk assigns last event's timestamp" problem. This way all events end up at the same time in the past.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jun 2022 19:37:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Why-is-powershell-scripted-Input-via-universal-forwarder-not/m-p/601613#M104812</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2022-06-13T19:37:11Z</dc:date>
    </item>
    <item>
      <title>Re: Why is Powershell Scripted Input via Universal Forwarder Not being Indexed?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Why-is-powershell-scripted-Input-via-universal-forwarder-not/m-p/604034#M105066</link>
      <description>&lt;P&gt;I've tried adding a timestamp to the PSObject and also without adding one (note the function in the above script is not ever called but is a good example of how I'd be adding that timestamp).&amp;nbsp;&lt;/P&gt;&lt;P&gt;The index they're (supposed to be) going to doesn't show the event even if searching all time.&amp;nbsp; That index does not regularly receive events so there's very little data there.&amp;nbsp; A real-time search on that index also does not show the events as they're arriving.&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jun 2022 20:25:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Why-is-powershell-scripted-Input-via-universal-forwarder-not/m-p/604034#M105066</guid>
      <dc:creator>wsgr_mccurity</dc:creator>
      <dc:date>2022-06-30T20:25:14Z</dc:date>
    </item>
    <item>
      <title>Re: Why is Powershell Scripted Input via Universal Forwarder Not being Indexed?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Why-is-powershell-scripted-Input-via-universal-forwarder-not/m-p/604077#M105072</link>
      <description>&lt;P&gt;I checked my script and the main part of it boils down to this:&lt;/P&gt;&lt;PRE&gt;[...]&lt;BR /&gt;foreach ($inputline in [...])&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp; $output=@{}&lt;BR /&gt;&amp;nbsp;&amp;nbsp; #Manipulate external data, extract some fields, set $output.fields&lt;BR /&gt;   [...]&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Write-Output $output&lt;BR /&gt;}&lt;/PRE&gt;&lt;P&gt;From what I found in the trimmed out block:&lt;/P&gt;&lt;PRE&gt; # First we need a timestamp&lt;BR /&gt;# Edit: No, we don't. We get the timestamp from the forwarder when the script is run&lt;BR /&gt;# $output.time =( Get-Date -Format "dd-mm-yyyy HH:mm:ss K" )&lt;/PRE&gt;&lt;P&gt;As you can see - I tried to set time manually but resigned in the end and rely on the forwarder supplying proper timestamp at ingest time.&lt;/P&gt;&lt;P&gt;For me it works.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Jul 2022 07:34:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Why-is-powershell-scripted-Input-via-universal-forwarder-not/m-p/604077#M105072</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2022-07-01T07:34:39Z</dc:date>
    </item>
  </channel>
</rss>

