Skip to content

Commit bcb2655

Browse files
authored
Add table github_security_log (#31)
1 parent f340740 commit bcb2655

File tree

6 files changed

+2373
-0
lines changed

6 files changed

+2373
-0
lines changed
Lines changed: 188 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,188 @@
1+
---
2+
title: "Tailpipe Table: github_security_log - Query GitHub Security Logs"
3+
description: "GitHub security logs list events triggered by activities that affect your personal account security."
4+
---
5+
6+
# Table: github_security_log - Query GitHub security logs
7+
8+
The `github_security_log` table allows you to query data from [GitHub security logs](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/reviewing-your-security-log). This table provides detailed information about security-related activity on your personal GitHub account, including sign-in events, SSH key changes, application authorizations, personal access token usage, and more.
9+
10+
Limitations and notes:
11+
12+
- The table currently supports exported logs in JSON format.
13+
- Security logs are available for personal accounts and contain events related to account security.
14+
15+
## Configure
16+
17+
Create a [partition](https://tailpipe.io/docs/manage/partition) for `github_security_log` ([examples](https://hub.tailpipe.io/plugins/turbot/github/tables/github_security_log#example-configurations)):
18+
19+
```sh
20+
vi ~/.tailpipe/config/github.tpc
21+
```
22+
23+
```hcl
24+
partition "github_security_log" "my_security_logs" {
25+
source "file" {
26+
paths = ["/Users/myuser/github_security_logs"]
27+
file_layout = `%{DATA}.json.gz`
28+
}
29+
}
30+
```
31+
32+
## Collect
33+
34+
[Collect](https://tailpipe.io/docs/manage/collection) logs for all `github_security_log` partitions:
35+
36+
```sh
37+
tailpipe collect github_security_log
38+
```
39+
40+
Or for a single partition:
41+
42+
```sh
43+
tailpipe collect github_security_log.my_security_logs
44+
```
45+
46+
## Query
47+
48+
**[Explore 33+ example queries for this table →](https://hub.tailpipe.io/plugins/turbot/github/queries/github_security_log)**
49+
50+
### Recent login attempts
51+
52+
Track recent login attempts to monitor account access.
53+
54+
```sql
55+
select
56+
timestamp,
57+
action,
58+
actor,
59+
tp_source_ip
60+
from
61+
github_security_log
62+
where
63+
action like '%login%'
64+
order by
65+
timestamp desc
66+
limit 10;
67+
```
68+
69+
### Personal access token activity
70+
71+
Monitor personal access token creation and usage.
72+
73+
```sql
74+
select
75+
timestamp,
76+
action,
77+
actor,
78+
token_scopes,
79+
tp_source_ip
80+
from
81+
github_security_log
82+
where
83+
action like 'personal_access_token.%'
84+
order by
85+
timestamp desc;
86+
```
87+
88+
### Two-factor authentication changes
89+
90+
Track changes to two-factor authentication settings.
91+
92+
```sql
93+
select
94+
timestamp,
95+
action,
96+
actor,
97+
tp_source_ip
98+
from
99+
github_security_log
100+
where
101+
action like 'two_factor_authentication.%'
102+
order by
103+
timestamp desc;
104+
```
105+
106+
### Repository-specific access events
107+
108+
Monitor security events for specific repositories using the repositories array.
109+
110+
```sql
111+
select
112+
timestamp,
113+
action,
114+
actor,
115+
repositories,
116+
permissions
117+
from
118+
github_security_log
119+
where
120+
repositories is not null
121+
and action like 'personal_access_token.%'
122+
order by
123+
timestamp desc;
124+
```
125+
126+
### Environment-related security events
127+
128+
Track security events associated with specific environments.
129+
130+
```sql
131+
select
132+
timestamp,
133+
action,
134+
actor,
135+
environment_id,
136+
environment_name
137+
from
138+
github_security_log
139+
where
140+
environment_id is not null
141+
order by
142+
timestamp desc;
143+
```
144+
145+
## Example Configurations
146+
147+
### Collect logs from local files
148+
149+
Collect GitHub security logs exported locally as JSON.
150+
151+
```hcl
152+
partition "github_security_log" "my_security_logs" {
153+
source "file" {
154+
paths = ["/Users/myuser/github_security_logs"]
155+
file_layout = `%{DATA}.json.gz`
156+
}
157+
}
158+
```
159+
160+
### Filter for high-priority security events
161+
162+
Use the filter argument in your partition to focus on critical security events.
163+
164+
```hcl
165+
partition "github_security_log" "critical_security_events" {
166+
filter = "action like '%login%' or action like 'two_factor_authentication.%' or action like 'personal_access_token.%'"
167+
168+
source "file" {
169+
paths = ["/Users/myuser/github_security_logs"]
170+
file_layout = `%{DATA}.json.gz`
171+
}
172+
}
173+
```
174+
175+
### Exclude routine events
176+
177+
Filter out routine events to focus on security-relevant activities.
178+
179+
```hcl
180+
partition "github_security_log" "security_alerts" {
181+
filter = "action not like 'user.show_private_contributions_count' and action not like 'user.hide_private_contributions_count'"
182+
183+
source "file" {
184+
paths = ["/Users/myuser/github_security_logs"]
185+
file_layout = `%{DATA}.json.gz`
186+
}
187+
}
188+
```

0 commit comments

Comments
 (0)