|
| 1 | +--- |
| 2 | +title: Visualize data from Azure Data Explorer using Kibana |
| 3 | +description: In this article, you learn how to set up Azure Data Explorer as a data source for Kibana |
| 4 | +author: orspod |
| 5 | +ms.author: orspodek |
| 6 | +ms.reviewer: guregini |
| 7 | +ms.service: data-explorer |
| 8 | +ms.topic: conceptual |
| 9 | +ms.date: 03/12/2020 |
| 10 | +--- |
| 11 | + |
| 12 | +# Visualize data from Azure Data Explorer in Kibana with the K2Bridge open-source connector |
| 13 | + |
| 14 | +K2Bridge (Kibana-Kusto Bridge) enables you to use Azure Data Explorer as the data source and to visualize that data in Kibana. K2Bridge is an [open-source](https://github.com/microsoft/K2Bridge) containerized application which acts as a proxy between a Kibana instance and an Azure Data Explorer cluster. This article describes how to use K2Bridge to create that connection. |
| 15 | + |
| 16 | +K2Bridge translates Kibana queries to Kusto Query Language (KQL) and sends the Azure Data Explorer results back to Kibana. |
| 17 | + |
| 18 | +  |
| 19 | + |
| 20 | +K2Bridge supports Kibana's Discover tab, where you can: |
| 21 | +* Search and explore the data |
| 22 | +* Filter results |
| 23 | +* Add or remove fields in the results grid |
| 24 | +* View record content |
| 25 | +* Save and share searches |
| 26 | + |
| 27 | +The image below shows a Kibana instance bound to Azure Data Explorer by K2Bridge. The user experience in Kibana is unchanged. |
| 28 | + |
| 29 | + [](media/k2bridge/k2bridge-kibana-page.png#lightbox) |
| 30 | + |
| 31 | +## Prerequisites |
| 32 | + |
| 33 | +Before you can visualize data from Azure Data Explorer in Kibana, have the following ready: |
| 34 | + |
| 35 | +* [Helm V3](https://github.com/helm/helm#install), the Kubernetes package manager |
| 36 | +* Azure Kubernetes Service (AKS) cluster, or any other Kubernetes cluster (version 1.14 to version 1.16 have been tested and verified). If you need an AKS cluster, see Deploy an AKS cluster [using the Azure CLI](https://docs.microsoft.com/azure/aks/kubernetes-walkthrough) or [using the Azure portal](https://docs.microsoft.com/azure/aks/kubernetes-walkthrough-portal) |
| 37 | +* An [Azure Data Explorer cluster](create-cluster-database-portal.md), including: |
| 38 | + * The Azure Data Explorer cluster's URL |
| 39 | + * The database name |
| 40 | + |
| 41 | +* An Azure AD service principal authorized to view data in Azure Data Explorer, including: |
| 42 | + * The Client ID |
| 43 | + * The Client Secret |
| 44 | + |
| 45 | + A service principal with 'Viewer' permission is recommended. It is discouraged to use higher permissions. |
| 46 | + |
| 47 | + * [Set the cluster's view permissions for the Azure AD service principal](https://docs.microsoft.com/azure/data-explorer/manage-database-permissions#manage-permissions-in-the-azure-portal). |
| 48 | + |
| 49 | + For more information about the Azure AD service principal, see [Create an Azure AD service principal](https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal#create-an-azure-active-directory-application). |
| 50 | + |
| 51 | +## Run K2Bridge on Azure Kubernetes Service (AKS) |
| 52 | + |
| 53 | +By default, K2Bridges's Helm chart references a publicly available image located on Microsoft's Container Registry (MCR). MCR doesn't require any credentials, and works out-of-the-box. |
| 54 | + |
| 55 | +1. Download the required Helm charts. |
| 56 | + |
| 57 | +1. Add the Elasticsearch dependency to Helm. |
| 58 | + The reason for the Elasticsearch dependency is that K2Bridge uses an internal small Elasticsearch instance to service metadata-related requests (such as index-patterns and saved queries). No business data is saved in this internal instance, and it can be considered as an implementation detail. |
| 59 | + |
| 60 | + 1. To add the Elasticsearch dependency to Helm: |
| 61 | + |
| 62 | + ```bash |
| 63 | + helm repo add elastic https://helm.elastic.co |
| 64 | + helm repo update |
| 65 | + ``` |
| 66 | + |
| 67 | + 1. To get the K2Bridge chart from under the charts directory of the GitHub repository: |
| 68 | + 1. Clone the repository from [GitHub](https://github.com/microsoft/K2Bridge). |
| 69 | + 1. Go to the K2Bridges root repository directory. |
| 70 | + 1. Run: |
| 71 | + |
| 72 | + ```bash |
| 73 | + helm dependency update charts/k2bridge |
| 74 | + ``` |
| 75 | + |
| 76 | +1. Deploy K2Bridge: |
| 77 | + |
| 78 | + 1. Set the variables with the correct values for your environment: |
| 79 | + |
| 80 | + ```bash |
| 81 | + ADX_URL=[YOUR_ADX_CLUSTER_URL] #For example, https://mycluster.westeurope.kusto.windows.net |
| 82 | + ADX_DATABASE=[YOUR_ADX_DATABASE_NAME] |
| 83 | + ADX_CLIENT_ID=[SERVICE_PRINCIPAL_CLIENT_ID] |
| 84 | + ADX_CLIENT_SECRET=[SERVICE_PRINCIPAL_CLIENT_SECRET] |
| 85 | + ADX_TENANT_ID=[SERVICE_PRINCIPAL_TENANT_ID] |
| 86 | + ``` |
| 87 | + |
| 88 | + 1. (Optional) Enable Azure Application Insights telemetry. |
| 89 | + If this is the first time you're using Azure Application Insights, you should first [create an Application Insights resource](https://docs.microsoft.com/azure/azure-monitor/app/create-new-resource). You will need to [copy the instrumentation key](https://docs.microsoft.com/azure/azure-monitor/app/create-new-resource#copy-the-instrumentation-key) to a variable: |
| 90 | +
|
| 91 | + ```bash |
| 92 | + APPLICATION_INSIGHTS_KEY=[INSTRUMENTATION_KEY] |
| 93 | + COLLECT_TELEMETRY=true |
| 94 | + ``` |
| 95 | +
|
| 96 | + 1. <a name="install-k2bridge-chart"></a>Install the K2Bridge chart: |
| 97 | +
|
| 98 | + ```bash |
| 99 | + helm install k2bridge charts/k2bridge -n k2bridge --set image.repository=$REPOSITORY_NAME/$CONTAINER_NAME --set settings.adxClusterUrl="$ADX_URL" --set settings.adxDefaultDatabaseName="$ADX_DATABASE" --set settings.aadClientId="$ADX_CLIENT_ID" --set settings.aadClientSecret="$ADX_CLIENT_SECRET" --set settings.aadTenantId="$ADX_TENANT_ID" [--set image.tag=latest] [--set privateRegistry="$IMAGE_PULL_SECRET_NAME"] [--set settings.collectTelemetry=$COLLECT_TELEMETRY] |
| 100 | + ``` |
| 101 | +
|
| 102 | + In [Configuration](https://github.com/microsoft/K2Bridge/blob/master/docs/configuration.md) you can find the complete set of configuration options. |
| 103 | +
|
| 104 | + 1. The command output will suggest the next Helm command to run to deploy Kibana. Optionally, run: |
| 105 | +
|
| 106 | + ```bash |
| 107 | + helm install kibana elastic/kibana -n k2bridge --set image=docker.elastic.co/kibana/kibana-oss --set imageTag=6.8.5 --set elasticsearchHosts=http://k2bridge:8080 |
| 108 | + ``` |
| 109 | + 1. Use port forwarding to access Kibana on localhost: |
| 110 | +
|
| 111 | + ```bash |
| 112 | + kubectl port-forward service/kibana-kibana 5601 --namespace k2bridge |
| 113 | + ``` |
| 114 | + 1. Connect to Kibana by browsing to http://127.0.0.1:5601. |
| 115 | +
|
| 116 | + 1. Expose Kibana to the end users. There are multiple methods to do so. The method you use largely depends on your use case. |
| 117 | +
|
| 118 | + For example: |
| 119 | +
|
| 120 | + Expose the service as a LoadBalancer service. To do so, add the following parameter to the K2Bridge Helm install command ([above](#install-k2bridge-chart)): |
| 121 | +
|
| 122 | + `--set service.type=LoadBalancer` |
| 123 | + |
| 124 | + Then run: |
| 125 | +
|
| 126 | + ```bash |
| 127 | + kubectl get service -w -n k2bridge |
| 128 | + ``` |
| 129 | + The output should look like: |
| 130 | +
|
| 131 | + ```bash |
| 132 | + NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE |
| 133 | + kibana-kibana LoadBalancer xx.xx.xx.xx <pending> 5601:30128/TCP 4m24s |
| 134 | + ``` |
| 135 | + You can then use the generated EXTERNAL-IP that appears, and use it to access Kibana by opening a browser to: `\<EXTERNAL-IP>:5601`. |
| 136 | +
|
| 137 | +1. Configure index patterns to access your data: |
| 138 | +In a new Kibana instance: |
| 139 | + 1. Open Kibana. |
| 140 | + 1. Navigate to Management. |
| 141 | + 1. Select **Index Patterns**. |
| 142 | + 1. Create an index pattern. |
| 143 | +The name of the index must exactly match the table name or function name, without an asterisk. You can copy the relevant line from the list. |
| 144 | +
|
| 145 | +> [!Note] |
| 146 | +> To run on other Kubernetes providers, change the Elasticsearch storageClassName in `values.yaml` to fit the one suggested by the provider. |
| 147 | +
|
| 148 | +## Visualize data |
| 149 | +
|
| 150 | +When Azure Data Explorer is configured as a data source for Kibana, you can use Kibana to explore the data. |
| 151 | +
|
| 152 | +1. In Kibana, on the left menu, select the **Discover** tab. |
| 153 | +
|
| 154 | +1. From the left drop-down list select an index pattern (in this case, an Azure Data Explorer table), which defines the data source you want to explore. |
| 155 | + |
| 156 | +  |
| 157 | +
|
| 158 | +1. If your data has a time-filter field, you can specify the time range. At the upper-right of the page, set a time filter. By default, Discover shows data for the last 15 minutes. |
| 159 | +
|
| 160 | +  |
| 161 | + |
| 162 | +1. The results table shows the first 500 records. You can expand a document to examine its field data in either JSON or table formats. |
| 163 | +
|
| 164 | +  |
| 165 | +
|
| 166 | +1. By default, the results table includes columns for the document _source and the time field (if it exists). You can choose specific columns to be added to the results table by selecting **add** next to the field name in the left sidebar. |
| 167 | +
|
| 168 | +  |
| 169 | + |
| 170 | +1. In the query bar, you can search the data by: |
| 171 | + * Entering a search term |
| 172 | + * Using the Lucene query syntax. |
| 173 | + For example: |
| 174 | + * Search "error" to find all the records that contain this value. |
| 175 | + * Search for "status: 200", to get all the records with a status value of 200. |
| 176 | + * Using logical operators (AND, OR, NOT) |
| 177 | + * Using wildcards (asterisk " \* " or question mark "?") |
| 178 | + For example: |
| 179 | + * The query `"destination_city: L*"` will match records where the destination city value starts with "l" (K2Bridge is not case-sensitive). |
| 180 | +
|
| 181 | +  |
| 182 | + |
| 183 | + > [!Tip] |
| 184 | + > In [Searching](https://github.com/microsoft/K2Bridge/blob/master/docs/searching.md), you can find more search rules and logic. |
| 185 | +
|
| 186 | +1. To filter your search results, use the **field list** on the right sidebar of the page. |
| 187 | + The field list is where you can see: |
| 188 | + * The top five values for the field |
| 189 | + * The number of records that contain the field |
| 190 | + * The percentage of records that contain each value. |
| 191 | + |
| 192 | + >[!Tip] |
| 193 | + > Use the (+) magnifier icon to find all records that have a specific value. |
| 194 | + |
| 195 | +  |
| 196 | + |
| 197 | + You can also filter the results by using the (+) magnifier icon in the results table format view of each record in the results table. |
| 198 | + |
| 199 | +  |
| 200 | + |
| 201 | +1. Select either to **Save** or **Share** your search. |
| 202 | +
|
| 203 | +  |
0 commit comments