How to obtain client IP addresses connecting to a ScaleArc cluster

Overview

This article outlines the steps to obtain the list of client IP addresses that connect to a particular ScaleArc cluster.

Information

Query Logs capture all client connections (applications) and SQL statements run against any database server in the ScaleArc cluster. The query log is useful when you suspect an error from a client and want to know exactly what the client or application sent to the database server. 

The list of client IP address connecting to ScaleArc can be extracted from the Query Log debug logs by following these steps:

  1. Ensure the logging level of the cluster is set to 'EXTENDED' (default setting) by clicking on 'Log Settings' in the cluster control panel. Logging_level.png

  2. Confirm that you have Query Logs for the particular period of interest by navigating to LIVE MONITOR > Logs > [Cluster Name] from the ScaleArc UI then select the 'Query Log' tab.
    Query_logs.png
    Tip: The Query Logs can also be easily accessed through the cluster quick links located next to the cluster name on the ScaleArc Control Panel.
  3. If the query logs contain log entries, it is possible to obtain the client IPs that initiated those queries by logging in to the ScaleArc instance via SSH, and going to the /data/logs/<date>/cid_<cluster_id>/ directory corresponding to the cluster-ID of your cluster. You can find the cluster-ID from the ScaleArc UI in the main Clusters page below the cluster name.
  4. List down the query logs per hour as by running this command:
    # ls -lh idb.log*
    -rw-r--r-- 1 root root  5G Nov 18 15:59 idb.log.2.2019111815
    -rw-r--r-- 1 root root  6G Nov 18 16:59 idb.log.2.2019111816
    -rw-r--r-- 1 root root  5G Nov 18 17:59 idb.log.2.2019111817
  5. Obtain the unique client IP addresses from the log files shown above by running the following command:
    # cat idb.log.* | awk -F  '#!#' '{print $4}' | sort -u
    The result will be a list of IP addresses that connected to ScaleArc at the given time. Below is sample output from running the above command:
    192.168.0.68
    192.168.1.180
    192.168.8.77
    192.168.9.248
    127.0.0.1

Back to top

 

Comments

0 comments

Please sign in to leave a comment.