How can you list in log the IP that connected to an inbound TCPIP thread?

Homepage Clovertech Forums Cloverleaf How can you list in log the IP that connected to an inbound TCPIP thread?

  • Creator
    Topic
  • #120008
    Jerry Sawa
    Participant

    We’re on Cloverleaf 19.1.2.1

    Is there a way, without logging set as “enable_all” to see the IP that connects to an inbound TCPIP thread?

    I see the three entries below in the log when I have thread set with “Enable Log Configuration” set as “enable_all“.  I don’t want to create an Engine Output Alias for those Module, Sub-module, Severity, and Level as that would add thousands of unneeded entries in the log.  Any help would be greatly appreciated.

    The first two are in the log when initial connection is established

    • [pdl :PDL :DBUG/0:<threadname>:10/20/2022 09:26:57] tcp-client: 100.40.100.147:49174 connect to server
    • [pdl :PDL :DBUG/0:<threadname>:10/20/2022 09:26:57] with args: {{client “100.40.100.147”} {status ok}}

    This one is in the log for every msg received

    • [pd :pdtd:INFO/3:<threadname>:–/–/—- –:–:–] msgDriverControl : {CONNID 0} {IPVERSION 4} {CLIENTIP 100.40.100.147} {CLIENTPORT 54656}
Viewing 10 reply threads
  • Author
    Replies
    • #120009
      Jim Kosloskey
      Participant

      The TCP/IP Protocol has a metadata Driver Control which has a keyed list that includes Keyed items CLIENTIP and CLIENTPORT.

      You could use some Tcl to display that on the log yourself. I think it is there with every message so but I am not sure if it is there at thread start. If it is only there with each message then you will need some logic i think to only display it once (I don’t think you want to fill he log with a display for each message).

      Hopefully the above will be of some use to you.

      Also hopefully others have further insight for you.

      email: jim.kosloskey@jim-kosloskey.com

    • #120010
      Jay Hammond
      Participant

      I’ve attached two eoaliases that I either found on here or read about on here and downloaded from the Infor Support site.  They’ve worked on version 6.2 and 20.0.1.

      Maybe these will do what  you’re looking for.

      EDIT:  I had to add a .txt extension to be able to upload the files.  Also, we’re on AIX if that matters with these.

       

      • This reply was modified 1 year, 6 months ago by Jay Hammond.
      • This reply was modified 1 year, 6 months ago by Jay Hammond.
      • This reply was modified 1 year, 6 months ago by Jay Hammond.
      Attachments:
      You must be logged in to view attached files.
      • #120019
        Jerry Sawa
        Participant

        Thanks Jay, but I think those will give me thousands of extra lines in the log that I don’t want.

      • #120020
        Jerry Sawa
        Participant

        Jim, I was thinking that too, but I don’t know where I would put the TCL code.

    • #120021
      Jim Kosloskey
      Participant

      IB Tps and at the start event if that is available at that point. Otherwise at run but to only get one logged line, you will need some logic to recognize the first time in the logic.

      Hopefully that MetaData is available at start. I just don’t recall and I don’t have access to a system so I could check.

      email: jim.kosloskey@jim-kosloskey.com

    • #120022
      Charlie Bursell
      Participant

      Jim:

      How can MetaData be available at start?  No messages received at this point

      🙂

       

    • #120023
      Jim Kosloskey
      Participant

      Doh! Thanks for the dope slap Charlie. Old age brain lapses.

      OK well there is a file in the process directory (thread_name.cli but you have to set “Save Client IP and Port to Driver Control” at the thread) and a Tcl Global variable (client_list – set the “Save Client IP and Port to Driver Control” at the thread) that contains the Active Client List consisting of Conn ID, IP address, and Port as a list for every conn ID in the Process.

      Hopefully there is someplace to get the Conn ID for the thread in question then find its entry in the client_list variable and echo the IP and Port info out. I am not exactly sure all the places one could find the Conn ID to match.

      I expect the file could be read in start but not sure that overhead is warranted.

      Just some musings…

      email: jim.kosloskey@jim-kosloskey.com

    • #120024
      Jerry Sawa
      Participant

      Jim – Wouldn’t that give me the IP and Port of the thread, not the IP of the server that connected to the thread?

    • #120025
      Jim Kosloskey
      Participant

      I think that gives you the IP and Port of the Client that connected to that thread (IB Thread) not the IP and Port of the Cloverleaf Server. You can simply view that file in the process directory when the thread is open to quickly validate that I would think.

      If you feel like chatting off line, email me.

      email: jim.kosloskey@jim-kosloskey.com

    • #120026
      Jeff Dawson
      Participant

      We currently run CIS 6.2.6.1 on AIX 7.2 and have lsof installed to get this information via a ksh script.  Before we used rmsock but found out the hard way that shouldn’t be used.

      Example of the base command

       

      sudo /usr/sbin/lsof -Pnw -i :<insert your port number> |grep :

    • #120027
      Paul Stein
      Participant

      We use 19.1 and achieve this by using multi server setting. It writes the active remote ip and socket to the threadname.cli file under the process directory, with no other setting changes needed. Doesn’t write to log file but suites the purpose at runtime.

    • #120028
      Charlie Bursell
      Participant

      Also available in Tcl via the client_list global value.

    • #120035
      Jerry Sawa
      Participant

      Thanks everyone.  All suggestions were very helpful.  I don’t actually need it in the log so I’m going with Paul’s suggestion, and I’ll look at .cli file if I need to know IP of the server that connected to the thread.

Viewing 10 reply threads
  • You must be logged in to reply to this topic.

Forum Statistics

Registered Users
5,074
Forums
28
Topics
9,252
Replies
34,241
Topic Tags
275