Skip to main content

GitHub data ingestion

GitHub records what changed in your repositories and who changed it. Sending those events to Coralogix puts that history next to your runtime telemetry, so a change in behavior can be lined up against the push or pull request that preceded it.

The Contextual Data integration generates both the webhook URL and the shared secret; GitHub posts to the URL and signs with the secret.

What you need

  • A GitHub repository you have permission to configure webhooks on.
  • A Coralogix API key. You can create one during setup.
  • An application and subsystem name to file the events under.

Generate the URL in Coralogix

1.
Open the GitHub integration

Select Data Flow, then Contextual Data, then GitHub, then Add, then Add new.

2.
Enter the integration details

Enter a Name. Supply Your API Key or select Create new key. Enter an App Name and Subsystem Name.

3.
Generate the URL and secret

Select Generate URL, then copy both the URL and the Secret. GitHub needs both.

Coralogix GitHub integration details form with name, API key, app name, and subsystem name fields

Shows the form that produces the webhook URL and shared secret.

Create the webhook in GitHub

4.
Open the repository's webhooks

Sign in to GitHub, open the repository you want to collect events from, then select Settings, then Webhooks.

5.
Add the webhook

Paste the generated URL into Payload URL and the generated secret into Secret, choose which events should trigger the webhook, then select Add webhook.

GitHub Add webhook form with payload URL, content type, secret, and event trigger options

Shows the form and the choice between push events, all events, and a hand-picked set.

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": "[email protected]",
        "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": "[email protected]: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": "[email protected]"
    },
    "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": "[email protected]",
          "username": "test"
        },
        "committer": {
          "name": "GitHub",
          "email": "[email protected]",
          "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": "[email protected]",
        "username": "test"
      },
      "committer": {
        "name": "GitHub",
        "email": "[email protected]",
        "username": "web-flow"
      },
      "added": [],
      "removed": [],
      "modified": [
        "README.md"
      ]
    }
  },
  "source_system": "github"
}
Last updated on