1
answer

Hi,

It's basically what the title implies.

I want to run a command that produces a string and save it as a variable to be used later in various output blocks. So far the command is working and I can send the output to a om_file logfile but I don't know how to assign the value to a variable to be used elsewhere in the config.

<Input powershell>
    Module  im_exec
    Command "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe"
    Arg     "$IP = Get-WmiObject  Win32_NetworkAdapterConfiguration | where {$_.IPEnabled};$IP.DefaultIPGateway"
    <Exec>
        parse_json();
        $EventTime = parsedate($EventTime);
    </Exec>
</Input>

Thanks!!

AskedJanuary 15, 2020 - 7:10pm

Comments (3)

  • casey1234's picture

    This was the answer at least for me:

    <Input powershell>
        Module  im_exec
        Command "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe"
        Arg     "$IP = Get-WmiObject  Win32_NetworkAdapterConfiguration | where {$_.IPEnabled};$IP.DefaultIPGateway"
        <Exec>
           $gateway = $raw_event;
        </Exec>
    </Input>
    

Answer (1)