Posh-SYSLOG icon indicating copy to clipboard operation
Posh-SYSLOG copied to clipboard

Allow Hostname Parameter to be provided as a PipelineParameter by Property Name

Open jberkers42 opened this issue 3 years ago • 1 comments

Is your feature request related to a problem? Please describe. I have a requirement to process some log data and send it on via Syslog, however, the log data itself contains the hostname, rather than being the same for all calls of the Send-SyslogMesssage. With the Hostname parameter not being considered as a Pipeline Parameter, the code would become more complex.

Describe the solution you'd like It would be great if the Hostname Parameter could be supplied in the Pipeline by Property Name.

Examples of how the solution would work

Convert-LogFile is an example function, that outputs PSObject with Message, Timestamp and Hostname.

$SyslogParameters = @{
  Server = '192.168.1.1'
  Severity = 'Informational'
  Facility = 'local1'
  Port = '514'
  Transport = 'UDP'
  ApplicationName = '-'
  FramingMethod = 'Non-Transparent-Framing'
}

Convert-LogFile -Path 'sample.log' | Send-SyslogMessage @SyslogParameters -RFC3164

Describe alternatives you've considered An alternate method would be to assign the results of the Convert-LogFile to a variable, and loop through the values (100's or potentially 1000's), calling Send-SyslogMessage with it's values.

Additional context The Hostname value is needed by my target SIEM system to be able to extract the originating host from the Syslog Relay header.

jberkers42 avatar Oct 27 '22 02:10 jberkers42

Hey @jberkers42,

I can't see any problems with switching this. I will do some testing and get back to you when it is published.

kjacobsen avatar Nov 06 '22 10:11 kjacobsen