Page 1 of 1

How to use find_client_id.sh

Posted: Mon Jul 18, 2022 8:04 am
by Pratik
While troubleshooting, you may want to analyze the connection status right from the beginning, when the connection began, profiles and web category added, headers received/sent by the proxy server, error or warning for the connection, etc.
But getting complete connection details just by navigating native logs is not possible, because the logs are written in real time as the connections are made.

For example, if you are requesting https://www.google.com and https://mail.google.com then log will be not written on the basis of connection, but on the basis of how the endpoint server response, which means you’ll need to hunt for complete connection details.

Getting complete connection log in a corporate network where they have hundreds of users is an impossible task and can lead to incomplete analysis for the problem.

find_client_id.sh can be used to get complete connection details.
Using the client id from logs will provide complete connection details.
Below are steps on how to use find_client_id.sh

To use find_client_id.sh you are first required to get your connection’s client id.
Client id can be extracted from the response headers section in browsers network tab.
(Note: we are assuming that you know how to open developer tools in a browser)
image.png
image.png (335.77 KiB) Viewed 1938 times
Also, client id can be extracted from SafeSquid’s native logs
image.png
image.png (305.34 KiB) Viewed 1937 times
Now using the client id, you can get complete connection details.
In your proxy server execute below command

Code: Select all

find_client_id.sh <client id of the connection> | less
In the above command find_client_id.sh is a bash script which gets complete connection details, <client id of the connection> client id of your connection and | less the output of the find_client_id.sh is piped to less which is a paging utility for better command output, search facility and overall controls.
image.png
image.png (7.05 KiB) Viewed 1930 times
image.png
image.png (371.06 KiB) Viewed 1935 times
By default, find_client_id.sh uses the log file safesquid.log from /var/log/safesquid/native folder.
safesquid.log is symbolic or soft link to the latest log file generated in native folder.

In case you need to get the output for find_client_id.sh from an old log files, use below find_client_id.sh syntax.

Code: Select all

find_client_id.sh <client id of the connection> <log file to use> | less
image.png
image.png (300.79 KiB) Viewed 1936 times
Below is an example to get find_client_id.sh for the log file from July 14 20220712205401-safesquid.log.
image.png
image.png (13.28 KiB) Viewed 1929 times
image.png
image.png (301.82 KiB) Viewed 1934 times
Output of find_client_is.sh can be saved and shared when sending support emails, for support technicians have better understanding of your problems.
To save the output of find_client_id.sh to a file, use redirection.

Code: Select all

find_client_id.sh <client id of the connection> > find_client_id_<client_id>_output.txt
or

Code: Select all

find_client_id.sh <client id of the connection> <log file to use> > find_client_id_<client_id>_output.txt
Output of above command will not be visible on terminal but will be saved to find_client_id_<client_id>_output.txt