

 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/)。

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

# STL\$1CONNECTION\$1LOG
<a name="r_STL_CONNECTION_LOG"></a>

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

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

此資料表中的部份或所有資料也會在 SYS 監控檢視 [SYS\$1CONNECTION\$1LOG](SYS_CONNECTION_LOG.md) 中找到。SYS 監視檢視中的資料會格式化為更易於使用和理解。我們建議您使用 SYS 監控檢視進行查詢。

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

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

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

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

```
select recordtime, username, dbname, remotehost, remoteport
from stl_connection_log
where event = 'initiating session'
and pid not in 
(select pid from stl_connection_log
where event = 'disconnecting session')
order by 1 desc;

recordtime          | username    | dbname     | remotehost    | remoteport                      
--------------------+-------------+------------+---------------+------------
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, recordtime, remotehost, username
from stl_connection_log order by recordtime;            

            event      |         recordtime        |  remotehost  | username                      
-----------------------+---------------------------+--------------+---------
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 stl_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 stl_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
```