Forum Discussion

Tim_McCarthy_20's avatar
Tim_McCarthy_20
Icon for Nimbostratus rankNimbostratus
Sep 17, 2018

Powershell REST security-log-profiles config

I'm writing a PowerShell script utilizing Joel's REST modules. I am successfully building the nodes, the pools, the VIPS, and all the associated profiles and policies, however I can't seem to get the security-log-profiles to configure. If I use the following

$vs = Get-VirtualServer -Name $Value.VirtualServerName

I can then see the profile by running this. echo $vs.securitylogprofiles

which returns this "/Common/Log illegal requests"

However if I clear the profile from the VIP, and re-pull the data into $vs and manipulate it as shown below, it does not write the profile to the F5.

$vs | Add-Member -Force -Name securitylogprofiles -Value "/Common/Log illegal requests" -MemberType NoteProperty

$vs | Set-VirtualServer

When set manually this is what the bigip.cnf looks like this.

security-log-profiles {
    "/Common/Log illegal requests"
}

Does anyone have any ideas on how to set this from PowerShell?

1 Reply

  • curl -X PATCH \
      'https://your_bigip_ip/mgmt/tm/ltm/virtual/~Common~some_vip_name-VS' \
      -H 'Authorization: Basic TXlRLVhdfhsadfsajfadsgasiufh=' \
      -H 'Content-Type: application/json' \
      -H 'Postman-Token: 03ac9874-ee45-4cce-a0dc-c54da1c78ae2' \
      -H 'cache-control: no-cache' \
      -d '{
        "securityLogProfiles": [
            "/Common/QRadar",
            "/Common/rsyslog_Azure",
            "/Common/local-dos"
        ]
    }'
    

    @Tim, above is the Curl call to add the security profiles of one's choice. For your local log profile, you need right escape characters like below

    ~Common~Log%20illegal%20requests

    Select my comment as a right answer once you test it out.

    Cheers