You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: Add JDBC log S3 upload with IAM role support
- Add JdbcLogUploader class for automatic JDBC log upload to S3
- Support both IAM role and explicit AWS credentials authentication
- Add configuration options for S3 upload (bucket, prefix, region, credentials)
- Enable JDBC tracing when log upload is enabled
- Upload logs only when communication errors occur
- Implement proper resource management with AutoCloseable
- Add cross-platform support using system temp directory
- Update README with configuration examples and usage instructions
- Add AWS SDK v2 dependencies with conflict exclusions
This feature helps with debugging Snowflake connection issues by
automatically uploading JDBC driver logs to S3 when errors occur.
Copy file name to clipboardExpand all lines: README.md
+49Lines changed: 49 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,6 +30,12 @@ Snowflake output plugin for Embulk loads records to Snowflake.
30
30
-**merge_rule**: list of column assignments for updating existing records used in merge mode, for example `"foo" = T."foo" + S."foo"` (`T` means target table and `S` means source table). (string array, default: always overwrites with new values)
31
31
-**batch_size**: size of a single batch insert (integer, default: 16777216)
32
32
-**match_by_column_name**: specify whether to load semi-structured data into columns in the target table that match corresponding columns represented in the data. ("case_sensitive", "case_insensitive", "none", default: "none")
33
+
-**upload_jdbc_log_to_s3**: enable automatic upload of JDBC driver logs to S3 when communication errors occur (boolean, default: false)
34
+
-**s3_bucket**: S3 bucket name for JDBC log upload (string, required when upload_jdbc_log_to_s3 is true)
35
+
-**s3_prefix**: S3 key prefix for JDBC log upload (string, required when upload_jdbc_log_to_s3 is true)
36
+
-**s3_region**: AWS region for S3 bucket (string, required when upload_jdbc_log_to_s3 is true)
37
+
-**s3_access_key_id**: AWS access key ID for S3 access (string, optional - uses IAM role if not specified)
38
+
-**s3_secret_access_key**: AWS secret access key for S3 access (string, optional - uses IAM role if not specified)
33
39
-**default_timezone**: If input column type (embulk type) is timestamp, this plugin needs to format the timestamp into a SQL string. This default_timezone option is used to control the timezone. You can overwrite timezone for each columns using column_options option. (string, default: `UTC`)
34
40
-**column_options**: advanced: a key-value pairs where key is a column name and value is options for the column.
35
41
-**type**: type of a column when this plugin creates new tables (e.g. `VARCHAR(255)`, `INTEGER NOT NULL UNIQUE`). This used when this plugin creates intermediate tables (insert, truncate_insert and merge modes), when it creates the target table (insert_direct and replace modes), and when it creates nonexistent target table automatically. (string, default: depends on input column type. `BIGINT` if input column type is long, `BOOLEAN` if boolean, `DOUBLE PRECISION` if double, `CLOB` if string, `TIMESTAMP` if timestamp)
@@ -62,6 +68,49 @@ Snowflake output plugin for Embulk loads records to Snowflake.
62
68
* Transactional: Yes.
63
69
* Resumable: No.
64
70
71
+
## JDBC Log Upload to S3
72
+
73
+
This plugin supports automatic upload of JDBC driver logs to S3 when communication errors occur. This feature is useful for debugging connection issues with Snowflake.
74
+
75
+
### Configuration Example
76
+
77
+
```yaml
78
+
out:
79
+
type: snowflake
80
+
host: your-account.snowflakecomputing.com
81
+
user: your_user
82
+
password: your_password
83
+
warehouse: your_warehouse
84
+
database: your_database
85
+
schema: your_schema
86
+
table: your_table
87
+
mode: insert
88
+
89
+
# JDBC log upload configuration
90
+
upload_jdbc_log_to_s3: true
91
+
s3_bucket: your-log-bucket
92
+
s3_prefix: snowflake-jdbc-logs
93
+
s3_region: us-east-1
94
+
95
+
# Optional: Explicit AWS credentials (uses IAM role if not specified)
96
+
s3_access_key_id: YOUR_ACCESS_KEY_ID
97
+
s3_secret_access_key: YOUR_SECRET_ACCESS_KEY
98
+
```
99
+
100
+
### Authentication Methods
101
+
102
+
1. **IAM Role (Recommended)**: Leave `s3_access_key_id` and `s3_secret_access_key` unspecified. The plugin will use the default AWS credentials provider chain (IAM role, environment variables, etc.).
103
+
104
+
2. **Explicit Credentials**: Specify both `s3_access_key_id` and `s3_secret_access_key` for explicit authentication.
105
+
106
+
### Behavior
107
+
108
+
- JDBC logs are only uploaded when communication errors occur during Snowflake operations
109
+
- The plugin automatically finds the latest `snowflake_jdbc*.log` file in the system temp directory
110
+
- Logs are uploaded to `s3://{bucket}/{prefix}/{filename}`
111
+
- If S3 upload fails, a warning is logged but the original error is still thrown
112
+
- If required S3 configuration is missing, a warning is logged and log upload is skipped
0 commit comments