What functions would you use to clean inconsistent log file data in Excel?
Translate this cleaning task into PostgreSQL. Normalize whitespace, capitalization, blank values, event labels, timestamps, and source codes, while identifying rows that need review.
log_id ascending.log_id, source_name, cleaned_event_type, cleaned_user_id, cleaned_event_at, cleaned_message, and data_quality_status.CLEAN when required cleaned fields and the source match are valid; otherwise use REVIEW.Unknown source when no matching source exists.user_id and message values to NULL; treat blank event labels and source codes likewise.YYYY-MM-DD HH:MM:SS or YYYY/MM/DD HH:MM formats; represent all others as NULL.data_quality_status to CLEAN only when the source matches and cleaned event type, user ID, timestamp, and message are non-NULL; otherwise use REVIEW.| Column | Type | Description |
|---|---|---|
| log_idPK | INT | Unique raw log identifier |
| source_code | VARCHAR(20) | Raw system source code |
| event_type | VARCHAR(100) | Raw event label |
| user_id | VARCHAR(50) | Raw user identifier |
| raw_timestamp | VARCHAR(40) | Timestamp stored as raw text |
| message | TEXT | Raw log message |
| Column | Type | Description |
|---|---|---|
| source_codePK | VARCHAR(20) | Canonical system source code |
| source_name | VARCHAR(100) | Readable system source name |