For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

ulises_01_14416's avatar
ulises_01_14416
Icon for Nimbostratus rankNimbostratus
Jul 21, 2016

log connection each minute

hello.

 

I need log each minute connections concurrents in my virtual server. pool and node. I saw with irules are can do but if there a script for do this.

 

thank and regards

 

4 Replies

  • Using iRules, you can generate a log entry every time a connection to the associated virtual server is created.

     

    You can also query the ltm to display all current connections (tmsh show sys connection), but be very careful with that command, as it can result in a heartbeat failure due to taking too long to complete, when there are a very large number of connections in the table. The command also accepts filters to limit the output to specific source/dest addresses, age, or connection type.

     

  • do you need connection details such as source and destination or only a connection count?

     

  • have you tried the commands by themselves yourself? when i run tmsh show sys connection i get

    Really display all connections? (y/n)

    which will break your script at this stage

    a solution seems to be

    tmsh -q show sys connection

    although doing a grep doesnt do anything for me here, as the last line is: Total records returned: 119, so it would have to be a grep Total i believe

    then the second line, why the -c ?

    tmsh show ltm node  | grep 'Current Connections'

    works for me fine

    then again as above for the final command

    script becomes (i have thrown in a date / time stamp, feel free to remove)

     !/bin/sh
    
     script para ejecutar comando cada minuto
    
    echo "$(date)"
    tmsh -q show sys connection | grep Total
    tmsh show ltm node node_135.208.45.223 | grep 'Current Connections'
    tmsh -q show sys connection | grep Total
    

    crontab looks almost fine although you seem to miss a first

    /
    and the path with root in home is kinda weird, but if these exisits all ok. also make sure your script is executable, test by first running the line

    root/home/root/Mi_script.sh >> /home/root/conexiones.txt

    you could do the >> in the script and not in the crontab, perhaps some linux gurus have opinions on this.