|
1 |
| -# tailpipe-plugin-github |
| 1 | +# GitHub Plugin for Tailpipe |
| 2 | + |
| 3 | +[Tailpipe](https://tailpipe.io) is an open-source CLI tool that allows you to collect logs and query them with SQL. |
| 4 | + |
| 5 | +[GitHub](https://www.github.com/) is a provider of Internet hosting for software development and version control using Git. It offers the distributed version control and source code management (SCM) functionality of Git, plus its own features. |
| 6 | + |
| 7 | +The [GitHub Plugin for Tailpipe](https://hub.tailpipe.io/plugins/turbot/github) allows you to collect and query GitHub audit logs using SQL to track activity, monitor trends, detect anomalies, and more! |
| 8 | + |
| 9 | +- **[Get started →](https://hub.tailpipe.io/plugins/turbot/github)** |
| 10 | +- Documentation: [Table definitions & examples](https://hub.tailpipe.io/plugins/turbot/github/tables) |
| 11 | +- Community: [Join #tailpipe on Slack →](https://turbot.com/community/join) |
| 12 | +- Get involved: [Issues](https://github.com/turbot/tailpipe-plugin-github/issues) |
| 13 | + |
| 14 | +Collect and query logs: |
| 15 | + |
| 16 | + |
| 17 | +## Getting Started |
| 18 | + |
| 19 | +Install Tailpipe from the [downloads](https://tailpipe.io/downloads) page: |
| 20 | + |
| 21 | +```sh |
| 22 | +# MacOS |
| 23 | +brew install turbot/tap/tailpipe |
| 24 | +``` |
| 25 | + |
| 26 | +```sh |
| 27 | +# Linux or Windows (WSL) |
| 28 | +sudo /bin/sh -c "$(curl -fsSL https://tailpipe.io/install/tailpipe.sh)" |
| 29 | +``` |
| 30 | + |
| 31 | +Install the plugin: |
| 32 | + |
| 33 | +```sh |
| 34 | +tailpipe plugin install github |
| 35 | +``` |
| 36 | + |
| 37 | +Configure your [connection credentials](https://hub.tailpipe.io/plugins/turbot/github#connection-credentials), table partition, and data source ([examples](https://hub.tailpipe.io/plugins/turbot/github/tables/github_audit_log#example-configurations)): |
| 38 | + |
| 39 | +```sh |
| 40 | +vi ~/.tailpipe/config/github.tpc |
| 41 | +``` |
| 42 | + |
| 43 | +```hcl |
| 44 | +partition "github_audit_log" "my_logs" { |
| 45 | + source "file" { |
| 46 | + paths = ["/Users/myuser/github_audit_logs"] |
| 47 | + file_layout = "%{DATA}.json.gz" |
| 48 | + } |
| 49 | +} |
| 50 | +``` |
| 51 | + |
| 52 | +Download, enrich, and save logs from your source ([examples](https://tailpipe.io/docs/reference/cli/collect)): |
| 53 | + |
| 54 | +```sh |
| 55 | +tailpipe collect github_audit_log |
| 56 | +``` |
| 57 | + |
| 58 | +Enter interactive query mode: |
| 59 | + |
| 60 | +```sh |
| 61 | +tailpipe query |
| 62 | +``` |
| 63 | + |
| 64 | +Run a query: |
| 65 | + |
| 66 | +```sql |
| 67 | +select |
| 68 | + action, |
| 69 | + count(*) as action_count |
| 70 | +from |
| 71 | + github_audit_log |
| 72 | +group by |
| 73 | + action |
| 74 | +order by |
| 75 | + action_count desc; |
| 76 | +``` |
| 77 | + |
| 78 | +```sh |
| 79 | ++----------------------------------------+--------------+ |
| 80 | +| action | action_count | |
| 81 | ++----------------------------------------+--------------+ |
| 82 | +| pull_request.create | 9894 | |
| 83 | +| pull_request.merge | 7440 | |
| 84 | +| issue_comment.update | 5832 | |
| 85 | +| packages.package_version_published | 4990 | |
| 86 | +| protected_branch.policy_override | 4012 | |
| 87 | +| pull_request_review.submit | 3672 | |
| 88 | +| pull_request_review_comment.create | 2516 | |
| 89 | +| pull_request.close | 2462 | |
| 90 | +| pull_request.create_review_request | 2438 | |
| 91 | +| repository_vulnerability_alert.create | 1972 | |
| 92 | +| repository_vulnerability_alert.resolve | 1486 | |
| 93 | +| repo.change_merge_setting | 892 | |
| 94 | ++----------------------------------------+--------------+ |
| 95 | +``` |
| 96 | + |
| 97 | +## Developing |
| 98 | + |
| 99 | +Prerequisites: |
| 100 | + |
| 101 | +- [Tailpipe](https://tailpipe.io/downloads) |
| 102 | +- [Golang](https://golang.org/doc/install) |
| 103 | + |
| 104 | +Clone: |
| 105 | + |
| 106 | +```sh |
| 107 | +git clone https://github.com/turbot/tailpipe-plugin-github.git |
| 108 | +cd tailpipe-plugin-github |
| 109 | +``` |
| 110 | + |
| 111 | +After making your local changes, build the plugin, which automatically installs the new version to your `~/.tailpipe/plugins` directory: |
| 112 | + |
| 113 | +```sh |
| 114 | +make |
| 115 | +``` |
| 116 | + |
| 117 | +Re-collect your data: |
| 118 | + |
| 119 | +```sh |
| 120 | +tailpipe collect github_audit_log |
| 121 | +``` |
| 122 | + |
| 123 | +Try it! |
| 124 | + |
| 125 | +```sh |
| 126 | +tailpipe query |
| 127 | +> .inspect github_audit_log |
| 128 | +``` |
| 129 | + |
| 130 | +## Open Source & Contributing |
| 131 | + |
| 132 | +This repository is published under the [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0) (source code) and [CC BY-NC-ND](https://creativecommons.org/licenses/by-nc-nd/2.0/) (docs) licenses. Please see our [code of conduct](https://github.com/turbot/.github/blob/main/CODE_OF_CONDUCT.md). We look forward to collaborating with you! |
| 133 | + |
| 134 | +[Tailpipe](https://tailpipe.io) is a product produced from this open source software, exclusively by [Turbot HQ, Inc](https://turbot.com). It is distributed under our commercial terms. Others are allowed to make their own distribution of the software, but cannot use any of the Turbot trademarks, cloud services, etc. You can learn more in our [Open Source FAQ](https://turbot.com/open-source). |
| 135 | + |
| 136 | +## Get Involved |
| 137 | + |
| 138 | +**[Join #tailpipe on Slack →](https://turbot.com/community/join)** |
| 139 | + |
| 140 | +Want to help but don't know where to start? Pick up one of the `help wanted` issues: |
| 141 | + |
| 142 | +- [Tailpipe](https://github.com/turbot/tailpipe/labels/help%20wanted) |
| 143 | +- [GitHub Plugin](https://github.com/turbot/tailpipe-plugin-github/labels/help%20wanted) |
0 commit comments