Forum Discussion

madi_56757's avatar
madi_56757
Icon for Nimbostratus rankNimbostratus
Nov 30, 2006

findstr help

Hello together;

 

 

I need a little help with the find sting command

 

 

when HTTP_REQUEST {

 

set hostname [findstr [HTTP::host] ":"]

 

log local0. "Host - $hostname"

 

 

Ok what i like to do is normaly easy

 

the request is followed

 

https://abc.easy.com:51000/index.html

 

 

what i need is only the hostname and not the port:

 

 

Nov 30 16:12:51 tmm tmm[810]: Rule hostname : Host - :51000

 

 

thanks a lot

 

Madi

1 Reply

  • Hello,

    If you're trying to get the hostname without the port, you can split on : and take field 1:

    (Click here)

    
    set host [getfield [HTTP::host] ":" 1]

    The second field should be the port:

    
    set port [getfield [HTTP::host] ":" 2]

    Aaron