Skip to content

Commit 73d48db

Browse files
committed
Addressed Copilot review comments
1 parent 1d0d5dc commit 73d48db

File tree

3 files changed

+4
-14
lines changed

3 files changed

+4
-14
lines changed

docs/tables/github_security_log/queries.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,7 @@ Identify peak activity hours for security events.
603603
604604
```sql
605605
select
606-
extract(hour from "@timestamp") as hour_of_day,
606+
extract(hour from timestamp) as hour_of_day,
607607
count(*) as event_count
608608
from
609609
github_security_log

tables/security_log/security_log_mapper.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func (m *SecurityLogMapper) Map(ctx context.Context, a any, _ ...mappers.MapOpti
3737
return nil, error_types.NewRowErrorWithMessage("invalid json string")
3838
}
3939
default:
40-
slog.Error("unable to map security log record: expected string/*string, got %T", a)
40+
slog.Error("unable to map security log record: expected string/*string", "got_type", fmt.Sprintf("%T", a))
4141
return nil, error_types.NewRowErrorWithMessage("unable to map row, invalid type received")
4242
}
4343

tables/security_log/security_log_table.go

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,8 @@ func (t *SecurityLogTable) EnrichRow(row *SecurityLog, sourceEnrichmentFields sc
4242

4343
// Parse timestamp from the @timestamp field
4444
if row.Timestamp != nil {
45-
if timestamp, err := time.Parse(time.RFC3339, row.Timestamp.Format(time.RFC3339)); err == nil {
46-
row.TpTimestamp = timestamp
47-
} else {
48-
// Fallback to current time if parsing fails
49-
row.TpTimestamp = time.Now()
50-
}
51-
} else {
52-
row.TpTimestamp = time.Now()
45+
row.TpTimestamp = *row.Timestamp
46+
row.TpDate = row.TpTimestamp.Truncate(24 * time.Hour)
5347
}
5448

5549
row.TpIngestTimestamp = time.Now()
@@ -62,10 +56,6 @@ func (t *SecurityLogTable) EnrichRow(row *SecurityLog, sourceEnrichmentFields sc
6256
row.TpUsernames = append(row.TpUsernames, *row.User)
6357
}
6458

65-
// Note: Security logs don't typically have direct IP fields like audit logs
66-
// We would need to extract from additional fields if available
67-
68-
row.TpDate = row.TpTimestamp.Truncate(24 * time.Hour)
6959
return row, nil
7060
}
7161

0 commit comments

Comments
 (0)