Bitbucket Data Ingestion

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

You can easily connect to your Bitbucket account using webhooks. The steps below are going to walk you through how to do so.

Generate your token

  1. Open in Coralogix: Settings -> Context Data Plugins
  2. Click on the Bitbucket 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 Bitbucket webhook

  1. Log in to your Bitbucket account.
  2. If you do not have a project, you want to create it . If you have already done that, please move to the next step.
  3. On the left  top corner click on your repository and select the repository you want to collect events from. 

A new screen will open, click Repository Settings.

Complete the form below and select the event you want to trigger the collection for.

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.

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

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

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

https://integrations.coralogix.com/v1/bitbucket/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:

{
	"source_system": "bitbucket",
	"bitbucket": {
		"changes": {
			"description": {
				"new": "My test repo",
				"old": "My first repo"
			}
		},
		"repository": {
			"scm": "git",
			"website": null,
			"uuid": "{0a519024-7bc7-49f8-add8-2fbe1d2cf66c}",
			"links": {
				"self": {
					"href": "https://api.bitbucket.org/2.0/repositories/test_user/testrepo"
				},
				"html": {
					"href": "https://bitbucket.org/test_user/testrepo"
				},
				"avatar": {
					"href": "https://bytebucket.org/ravatar/%7B0a519024-7bc7-49f8-add8-2fbe1d2cf66c%7D?ts=default"
				}
			},
			"project": {
				"links": {
					"self": {
						"href": "https://api.bitbucket.org/2.0/workspaces/test_user/projects/AD"
					},
					"html": {
						"href": "https://bitbucket.org/test_user/workspace/projects/AD"
					},
					"avatar": {
						"href": "https://bitbucket.org/account/user/test_user/projects/AD/avatar/32?ts=1623065966"
					}
				},
				"type": "project",
				"name": "TestProject",
				"key": "AD",
				"uuid": "{12345678-b705-40c8-af4c-7905c047d73b}"
			},
			"full_name": "test_user/testrepo",
			"owner": {
				"display_name": "John Smith",
				"uuid": "{1234abcd-0000-aaaa-1111-0123456789ab}",
				"links": {
					"self": {
						"href": "https://api.bitbucket.org/2.0/users/%1234abcd-0000-aaaa-1111-0123456789ab"
					},
					"html": {
						"href": "https://bitbucket.org/%1234abcd-0000-aaaa-1111-0123456789ab/"
					},
					"avatar": {
						"href": "https://secure.gravatar.com/avatar/d8dee7d2f2ac223263989224f7f99fe3?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FAP-2.png"
					}
				},
				"type": "user",
				"nickname": "John Smith",
				"account_id": "01234567892cc1006957e666"
			},
			"workspace": {
				"slug": "test_user",
				"type": "workspace",
				"name": "John Smith",
				"links": {
					"self": {
						"href": "https://api.bitbucket.org/2.0/workspaces/test_user"
					},
					"html": {
						"href": "https://bitbucket.org/test_user/"
					},
					"avatar": {
						"href": "https://bitbucket.org/workspaces/test_user/avatar/?ts=1623065881"
					}
				},
				"uuid": "{12345678-1111-2222-aaaa-74e612ecd2ae}"
			},
			"type": "repository",
			"is_private": true,
			"name": "TestRepo"
		},
		"actor": {
			"display_name": "John Smith",
			"uuid": "{12345678-1111-2222-bbbb-74e612ecd2ae}",
			"links": {
				"self": {
					"href": "https://api.bitbucket.org/2.0/users/%1234abcd-0000-aaaa-1111-0123456789ab"
				},
				"html": {
					"href": "https://bitbucket.org/%1234abcd-0000-aaaa-1111-0123456789ab/"
				},
				"avatar": {
					"href": "https://secure.gravatar.com/avatar/d8dee7d2f2ac223263989224f7f99fe3?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FAP-2.png"
				}
			},
			"type": "user",
			"nickname": "John Smith",
			"account_id": "01234567892cc1006957e666"
		}
	}
}