<?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: How to ingest PowerShell script that outputs json? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-to-ingest-PowerShell-script-that-outputs-json/m-p/652606#M110771</link>
    <description>&lt;P&gt;You use slashes as path separators, not backslashes. In my experience something like this worked:&lt;/P&gt;&lt;PRE&gt;[powershell://your-stanza-name]&lt;BR /&gt;script= . "$SplunkHome\etc\apps\your_app\bin\scripts\your_script.ps1&lt;/PRE&gt;</description>
    <pubDate>Mon, 31 Jul 2023 20:55:54 GMT</pubDate>
    <dc:creator>PickleRick</dc:creator>
    <dc:date>2023-07-31T20:55:54Z</dc:date>
    <item>
      <title>How to ingest PowerShell script that outputs json?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-ingest-PowerShell-script-that-outputs-json/m-p/652413#M110758</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a PowerShell script that parses emails and pulls out specific header data that I want in Splunk. While writing the script I decided to have it output json as I thought that would be a good option to feed to splunk. I produced a sample json log file (one line json per message I want parsed) and setup a sourcetype via the interactive add data wizard. I then added that sourcetype to my app's props.conf.&amp;nbsp;&lt;/P&gt;&lt;P&gt;My issue is I cannot seem to find the right way to get splunk to execute the powershell script. I've tried script:// with the ps1, with a .path file, and recently tried powershell:// with a script parameter. Nothing seems to be working.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any guidance on how to make this would be great. I don't want to have to resort to a scheduled task running the script which outputs to a log file that splunk monitors, but I can do that if I need to.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my inputs.conf that I tried:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[script://$SPLUNK_HOME/etc/apps/phishalert/bin/phishalert_output.ps1]
disabled = 1
interval = 300
index = email
source = phishalert
sourcetype = phishalert

[script://$SPLUNK_HOME/etc/apps/phishalert/bin/phishalert_output.path]
disabled = 1
interval = 300
index = email
source = phishalert
sourcetype = phishalert

[powershell://PhishAlertOutput]
disabled = 1
script = . "$SPLUNKHOME/etc/apps/phishalert/bin/phishalert_output.ps1"
schedule = */5 * * * *
sourcetype = phishalert&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the props.conf:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[phishalert]
DATETIME_CONFIG = 
INDEXED_EXTRACTIONS = json
KV_MODE = none
LINE_BREAKER = ([\r\n]+)
TIMESTAMP_FIELDS = timestamp
category = Structured
description = Phish alert json data.
disabled = false
pulldown_type = true&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jul 2023 19:19:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-ingest-PowerShell-script-that-outputs-json/m-p/652413#M110758</guid>
      <dc:creator>rufflabs</dc:creator>
      <dc:date>2023-07-28T19:19:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to ingest PowerShell script that outputs json?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-ingest-PowerShell-script-that-outputs-json/m-p/652451#M110761</link>
      <description>&lt;P&gt;Splunk is being asked to run a PowerShell script on what looks like a *nix system. Is there a PowerShell interpreter installed on this Splunk host?&lt;/P&gt;&lt;P&gt;If so, you may need to do something like:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[script://path/to/pwsh $SPLUNK_HOME/etc/apps/phishalert/bin/phishalert_output.ps1]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There are a few other options in the [script] section of inputs.conf.spec that you might want to explore, including "start_by_shell".&lt;/P&gt;</description>
      <pubDate>Sat, 29 Jul 2023 22:56:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-ingest-PowerShell-script-that-outputs-json/m-p/652451#M110761</guid>
      <dc:creator>cklunck</dc:creator>
      <dc:date>2023-07-29T22:56:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to ingest PowerShell script that outputs json?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-ingest-PowerShell-script-that-outputs-json/m-p/652549#M110765</link>
      <description>&lt;P&gt;This is all Windows, what makes you think it's linux? Did I misconfigure something?&lt;/P&gt;</description>
      <pubDate>Mon, 31 Jul 2023 14:23:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-ingest-PowerShell-script-that-outputs-json/m-p/652549#M110765</guid>
      <dc:creator>rufflabs</dc:creator>
      <dc:date>2023-07-31T14:23:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to ingest PowerShell script that outputs json?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-ingest-PowerShell-script-that-outputs-json/m-p/652606#M110771</link>
      <description>&lt;P&gt;You use slashes as path separators, not backslashes. In my experience something like this worked:&lt;/P&gt;&lt;PRE&gt;[powershell://your-stanza-name]&lt;BR /&gt;script= . "$SplunkHome\etc\apps\your_app\bin\scripts\your_script.ps1&lt;/PRE&gt;</description>
      <pubDate>Mon, 31 Jul 2023 20:55:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-ingest-PowerShell-script-that-outputs-json/m-p/652606#M110771</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2023-07-31T20:55:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to ingest PowerShell script that outputs json?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-ingest-PowerShell-script-that-outputs-json/m-p/652897#M110792</link>
      <description>&lt;P&gt;Hah, that shouldn't matter because PowerShell can interpret both methods, but sure enough that got it working. Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 02 Aug 2023 13:24:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-ingest-PowerShell-script-that-outputs-json/m-p/652897#M110792</guid>
      <dc:creator>rufflabs</dc:creator>
      <dc:date>2023-08-02T13:24:48Z</dc:date>
    </item>
  </channel>
</rss>

