

 Amazon Redshift 將不再支援從修補程式 198 開始建立新的 Python UDFs。現有 Python UDF 將繼續正常運作至 2026 年 6 月 30 日。如需詳細資訊，請參閱[部落格文章](https://aws.amazon.com/blogs/big-data/amazon-redshift-python-user-defined-functions-will-reach-end-of-support-after-june-30-2026/)。

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# SYS\_CONNECTION\_LOG
<a name="SYS_CONNECTION_LOG"></a>

記錄身分驗證嘗試以及連線和中斷連線。

只有超級使用者才能看到 SYS\_CONNECTION\_LOG。如需詳細資訊，請參閱[系統資料表和檢視中資料的可見性](cm_chap_system-tables.md#c_visibility-of-data)。

## 資料表欄
<a name="SYS_CONNECTION_LOG-table-columns2"></a>

[See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/redshift/latest/dg/SYS_CONNECTION_LOG.html)

## 範例查詢
<a name="SYS_CONNECTION_LOG-sample-queries2"></a>

若要檢視已開啟之連線的詳細資訊，請執行下列查詢。

```
select record_time, user_name, database_name, remote_host, remote_port
from sys_connection_log
where event = 'initiating session'
and session_id not in 
(select session_id from sys_connection_log
where event = 'disconnecting session')
order by 1 desc;

record_time         | user_name   | database_name   | remote_host   | remote_port                      
--------------------+-------------+-----------------+---------------+---------------------------------
2014-11-06 20:30:06 | rdsdb       | dev             | [local]       |                            
2014-11-06 20:29:37 | test001     | test            | 10.49.42.138  | 11111                           
2014-11-05 20:30:29 | rdsdb       | dev             | 10.49.42.138  | 33333                                                 
2014-11-05 20:28:35 | rdsdb       | dev             | [local]       |  
(4 rows)
```

下列範例反映失敗的身分驗證嘗試，以及成功的連線和中斷連線。

```
select event, record_time, remote_host, user_name
from sys_connection_log order by record_time;            

            event      |         record_time        |  remote_host  | user_name                      
-----------------------+----------------------------+---------------+---------
authentication failure | 2012-10-25 14:41:56.96391  | 10.49.42.138  | john                                              
authenticated          | 2012-10-25 14:42:10.87613  | 10.49.42.138  | john                                              
initiating session     | 2012-10-25 14:42:10.87638  | 10.49.42.138  | john                                              
disconnecting session  | 2012-10-25 14:42:19.95992  | 10.49.42.138  | john                                              
(4 rows)
```

下列範例顯示 ODBC 驅動程式的版本、用戶端機器上的作業系統，以及用來連線到 Amazon Redshift 叢集的外掛程式。在此範例中，使用的外掛程式用於使用登入名稱和密碼進行標準 ODBC 驅動程式驗證。

```
select driver_version, os_version, plugin_name from sys_connection_log;
                
driver_version                          |  os_version                       | plugin_name
----------------------------------------+-----------------------------------+--------------------
Amazon Redshift ODBC Driver 1.4.15.0001 | Darwin 18.7.0 x86_64              | none
Amazon Redshift ODBC Driver 1.4.15.0001 | Linux 4.15.0-101-generic x86_64   | none
```

下列範例顯示用戶端電腦上的作業系統版本、驅動程式版本和通訊協定版本。

```
select os_version, driver_version, protocol_version from sys_connection_log;
                
os_version                      |  driver_version              | protocol_version
--------------------------------+------------------------------+--------------------
Linux 4.15.0-101-generic x86_64 | Redshift JDBC Driver 2.0.0.0 | 2
Linux 4.15.0-101-generic x86_64 | Redshift JDBC Driver 2.0.0.0 | 2 
Linux 4.15.0-101-generic x86_64 | Redshift JDBC Driver 2.0.0.0 | 2
```