GitHub Data Ingestion

Coralogix allows you to monitor who, when and what was accessed and modified on your GitHub repo. Using Coralogix alerts and visualizations you can get insights into the status of repo’s, and branches, and into activities like commits and pulls. Consolidating all logs into Coralogix allows you to view application/infrastructure logs in the context of GitHub’s when doing root-cause or impact analysis.     

Using webhooks you can easily connect to your GitHub account. The steps below are going to walk you through how to do so.

You can read more about GitHub Webhook integration here.

Generate your token

  1. Open in Coralogix: Settings -> Context Data Plugins
  2. Click on the GitHub tab.
  3. Click on the “+ADD NEW KEY”  button.
  4. Enter integration name in the pop-up window (it can be any name).
  5. The token will show up on the list.

Create GitHub webhook

  1. Log in to your GitHub account.
  2. If you do not have a project, you want to create it and create a repository under this project. If you have already done that, please move to the next step.
  3. On the right top corner click on your name and select your repositories tab.

Select the repository you want to add the webhook integration to.

 

Click on Settings, and click on webhooks.

 

Now you want to complete the required information on the right side.

The following payload URL has a variable part (in Italic). Please match this part with a row entry within the table. Copy the table row entry located under the column that matches the top-level domain of your Coralogix account (.com, .in, etc.). Replace the variable part of the URL with this entry.

 EUINUSA
Cluster URLcoralogix.comapp.coralogix.incoralogix.us
Team URL.coralogix.com.app.coralogix.in.app.coralogix.us

 

Payload URL

Content Type

Secret

https://integrations.Cluster URL/v1/github/v1/events/<token>

application/json

This is the same as the token in the payload URL

If you like to specify the application name and subsystem name you can add them right after the token in the payload URL like the below example.

https://integrations.coralogix.com/v1/github/v1/events/11111111-1111-1111-1111-111111111111?appName=MyApp&subSystem=MySubsystem

Make sure the URL end point corresponds with the top level domain of your account URL (.com, .in, .us). See table above.

 

Example log:

{
  "github": {
    "ref": "refs/heads/main",
    "before": "02b0534caddfd9d221cc6ac61f6b6f7c226336a3",
    "after": "15cb0605d8097d645036c499ca84253e75d7367f",
    "repository": {
      "id": 323160153,
      "node_id": "MDEwOlJlcG9zaXRvcnkzMjMxNjAxNTM=",
      "name": "my_first_repo",
      "full_name": "test/my_first_repo",
      "private": true,
      "owner": {
        "name": "test",
        "email": "111111+test@users.noreply.github.com",
        "login": "test",
        "id": 11111111,
        "node_id": "MDQ6VXNlcjc2NDA4Mzcw",
        "avatar_url": "https://avatars.githubusercontent.com/u/11111111?v=4",
        "gravatar_id": "",
        "url": "https://api.github.com/users/test",
        "html_url": "https://github.com/test",
        "followers_url": "https://api.github.com/users/test/followers",
        "following_url": "https://api.github.com/users/test/following{/other_user}",
        "gists_url": "https://api.github.com/users/test/gists{/gist_id}",
        "starred_url": "https://api.github.com/users/test/starred{/owner}{/repo}",
        "subscriptions_url": "https://api.github.com/users/test/subscriptions",
        "organizations_url": "https://api.github.com/users/test/orgs",
        "repos_url": "https://api.github.com/users/test/repos",
        "events_url": "https://api.github.com/users/test/events{/privacy}",
        "received_events_url": "https://api.github.com/users/test/received_events",
        "type": "User",
        "site_admin": false
      },
      "html_url": "https://github.com/test/my_first_repo",
      "description": "It just for testing",
      "fork": false,
      "url": "https://github.com/test/my_first_repo",
      "forks_url": "https://api.github.com/repos/test/my_first_repo/forks",
      "keys_url": "https://api.github.com/repos/test/my_first_repo/keys{/key_id}",
      "collaborators_url": "https://api.github.com/repos/test/my_first_repo/collaborators{/collaborator}",
      "teams_url": "https://api.github.com/repos/test/my_first_repo/teams",
      "hooks_url": "https://api.github.com/repos/test/my_first_repo/hooks",
      "issue_events_url": "https://api.github.com/repos/test/my_first_repo/issues/events{/number}",
      "events_url": "https://api.github.com/repos/test/my_first_repo/events",
      "assignees_url": "https://api.github.com/repos/test/my_first_repo/assignees{/user}",
      "branches_url": "https://api.github.com/repos/test/my_first_repo/branches{/branch}",
      "tags_url": "https://api.github.com/repos/test/my_first_repo/tags",
      "blobs_url": "https://api.github.com/repos/test/my_first_repo/git/blobs{/sha}",
      "git_tags_url": "https://api.github.com/repos/test/my_first_repo/git/tags{/sha}",
      "git_refs_url": "https://api.github.com/repos/test/my_first_repo/git/refs{/sha}",
      "trees_url": "https://api.github.com/repos/test/my_first_repo/git/trees{/sha}",
      "statuses_url": "https://api.github.com/repos/test/my_first_repo/statuses/{sha}",
      "languages_url": "https://api.github.com/repos/test/my_first_repo/languages",
      "stargazers_url": "https://api.github.com/repos/test/my_first_repo/stargazers",
      "contributors_url": "https://api.github.com/repos/test/my_first_repo/contributors",
      "subscribers_url": "https://api.github.com/repos/test/my_first_repo/subscribers",
      "subscription_url": "https://api.github.com/repos/test/my_first_repo/subscription",
      "commits_url": "https://api.github.com/repos/test/my_first_repo/commits{/sha}",
      "git_commits_url": "https://api.github.com/repos/test/my_first_repo/git/commits{/sha}",
      "comments_url": "https://api.github.com/repos/test/my_first_repo/comments{/number}",
      "issue_comment_url": "https://api.github.com/repos/test/my_first_repo/issues/comments{/number}",
      "contents_url": "https://api.github.com/repos/test/my_first_repo/contents/{+path}",
      "compare_url": "https://api.github.com/repos/test/my_first_repo/compare/{base}...{head}",
      "merges_url": "https://api.github.com/repos/test/my_first_repo/merges",
      "archive_url": "https://api.github.com/repos/test/my_first_repo/{archive_format}{/ref}",
      "downloads_url": "https://api.github.com/repos/test/my_first_repo/downloads",
      "issues_url": "https://api.github.com/repos/test/my_first_repo/issues{/number}",
      "pulls_url": "https://api.github.com/repos/test/my_first_repo/pulls{/number}",
      "milestones_url": "https://api.github.com/repos/test/my_first_repo/milestones{/number}",
      "notifications_url": "https://api.github.com/repos/test/my_first_repo/notifications{?since,all,participating}",
      "labels_url": "https://api.github.com/repos/test/my_first_repo/labels{/name}",
      "releases_url": "https://api.github.com/repos/test/my_first_repo/releases{/id}",
      "deployments_url": "https://api.github.com/repos/test/my_first_repo/deployments",
      "created_at": 1608496588,
      "updated_at": "2021-07-16T07:39:25Z",
      "pushed_at": 1626421494,
      "git_url": "git://github.com/test/my_first_repo.git",
      "ssh_url": "git@github.com:test/my_first_repo.git",
      "clone_url": "https://github.com/test/my_first_repo.git",
      "svn_url": "https://github.com/test/my_first_repo",
      "homepage": null,
      "size": 0,
      "stargazers_count": 0,
      "watchers_count": 0,
      "language": null,
      "has_issues": true,
      "has_projects": true,
      "has_downloads": true,
      "has_wiki": true,
      "has_pages": false,
      "forks_count": 0,
      "mirror_url": null,
      "archived": false,
      "disabled": false,
      "open_issues_count": 1,
      "license": null,
      "forks": 0,
      "open_issues": 1,
      "watchers": 0,
      "default_branch": "main",
      "stargazers": 0,
      "master_branch": "main"
    },
    "pusher": {
      "name": "test",
      "email": "111111+test@users.noreply.github.com"
    },
    "sender": {
      "login": "test",
      "id": 1111111,
      "node_id": "MDQ6VXNlcjc2NDA4Mzcw",
      "avatar_url": "https://avatars.githubusercontent.com/u/11111111?v=4",
      "gravatar_id": "",
      "url": "https://api.github.com/users/test",
      "html_url": "https://github.com/test",
      "followers_url": "https://api.github.com/users/test/followers",
      "following_url": "https://api.github.com/users/test/following{/other_user}",
      "gists_url": "https://api.github.com/users/test/gists{/gist_id}",
      "starred_url": "https://api.github.com/users/test/starred{/owner}{/repo}",
      "subscriptions_url": "https://api.github.com/users/test/subscriptions",
      "organizations_url": "https://api.github.com/users/test/orgs",
      "repos_url": "https://api.github.com/users/test/repos",
      "events_url": "https://api.github.com/users/test/events{/privacy}",
      "received_events_url": "https://api.github.com/users/test/received_events",
      "type": "User",
      "site_admin": false
    },
    "created": false,
    "deleted": false,
    "forced": false,
    "base_ref": null,
    "compare": "https://github.com/test/my_first_repo/compare/02b0534caddf...15cb0605d809",
    "commits": [
      {
        "id": "15cb0605d8097d645036c499ca84253e75d73611",
        "tree_id": "a28d049bbe7fd047cf9171b13f969750662d1211",
        "distinct": true,
        "message": "Update README.md",
        "timestamp": "2021-07-16T09:44:53+02:00",
        "url": "https://github.com/test/my_first_repo/commit/15cb0605d8097d645036c499ca84253e11111",
        "author": {
          "name": "test",
          "email": "11111111+test@users.noreply.github.com",
          "username": "test"
        },
        "committer": {
          "name": "GitHub",
          "email": "noreply@github.com",
          "username": "web-flow"
        },
        "added": [],
        "removed": [],
        "modified": [
          "README.md"
        ]
      }
    ],
    "head_commit": {
      "id": "15cb0605d8097d645036c499ca84253e75d73611",
      "tree_id": "a28d049bbe7fd047cf9171b13f969750662d1211",
      "distinct": true,
      "message": "Update README.md",
      "timestamp": "2021-07-16T09:44:53+02:00",
      "url": "https://github.com/test/my_first_repo/commit/15cb0605d8097d645036c499ca84253e7511111",
      "author": {
        "name": "test",
        "email": "11111111+test@users.noreply.github.com",
        "username": "test"
      },
      "committer": {
        "name": "GitHub",
        "email": "noreply@github.com",
        "username": "web-flow"
      },
      "added": [],
      "removed": [],
      "modified": [
        "README.md"
      ]
    }
  },
  "source_system": "github"
}