-
Notifications
You must be signed in to change notification settings - Fork 2
chore: clickhouse scraper docs #400
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
yashmehrotra
wants to merge
3
commits into
main
Choose a base branch
from
clickhouse-docs
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
106 changes: 106 additions & 0 deletions
106
mission-control/docs/guide/config-db/scrapers/clickhouse.mdx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
--- | ||
title: Clickhouse | ||
show_title: false | ||
sidebar_custom_props: | ||
icon: clickhouse-icon | ||
--- | ||
|
||
|
||
# <Icon name="clickhouse-icon"/> Clickhouse | ||
|
||
The Clickhouse scraper will execute a query and then create a catalog item for each returned row. | ||
|
||
The example below creates a new `Order` config for each row, with name as `order_id` and the row in json format as the config. | ||
|
||
```yaml title="clickhouse-scraper.yaml" file=<rootDir>/modules/config-db/fixtures/clickhouse.yaml | ||
``` | ||
|
||
Objects in external storages like AzureBlobStorage or AWS S3 can also be queried | ||
|
||
```yaml title="azure-blob-storage-scraper.yaml" | ||
apiVersion: mission-control.flanksource.com/v1 | ||
kind: Connection | ||
metadata: | ||
name: azure-prod | ||
spec: | ||
azure: | ||
clientID: | ||
valueFrom: | ||
secretKeyRef: | ||
name: azure-creds | ||
key: CLIENT_ID | ||
clientSecret: | ||
valueFrom: | ||
secretKeyRef: | ||
name: azure-creds | ||
key: CLIENT_SECRET | ||
tenantID: | ||
valueFrom: | ||
secretKeyRef: | ||
name: azure-creds | ||
key: TENANT_ID | ||
--- | ||
apiVersion: configs.flanksource.com/v1 | ||
kind: ScrapeConfig | ||
metadata: | ||
name: audit-logs | ||
spec: | ||
clickhouse: | ||
- query: SELECT * FROM azureBlobStorage(azure_prod_audit_data); | ||
type: AuditRecord | ||
id: $.user_id | ||
transform: | ||
expr: "[config].toJSON()" | ||
azureBlobStorage: | ||
connection: azure-prod | ||
account: acme-logs | ||
container: audit | ||
path: audit-data.csv | ||
collection: azure_prod_audit_data | ||
``` | ||
|
||
:::info | ||
An instance of clichkouse server needs to be deployed for this scraper to function. | ||
|
||
Mission Control can deploy an instance by setting `config-db.clichkouse.enabled: true` in the helm chart. | ||
|
||
An external clichkouse server can also be used via the `clickhouseURL` parameter | ||
::: | ||
|
||
## Scraper | ||
|
||
| Field | Description | Scheme | Required | | ||
| ----------- | ---------------------------------------------------------------------------------- | -------------------------------------------- | -------- | | ||
| `logLevel` | Specify the level of logging. | `string` | | | ||
| `schedule` | Specify the interval to scrape in cron format. Defaults to every 60 minutes. | `string` | | | ||
| `full` | Set to `true` to extract changes from scraped configurations. Defaults to `false`. | `bool` | | | ||
| `retention` | Settings for retaining changes, analysis and scraped items | [`Retention`](/guide/config-db/concepts/retention) | | | ||
| `clickhouse`| Specifies the list of SQL configurations to scrape. | [`[]Clickhouse`](#clickhouse) | | | ||
|
||
## Clickhouse | ||
|
||
<CustomScraper rows={[ | ||
{field: "awsS3", description: "AWS S3 configuration for accessing buckets", scheme: "[AWSS3](#awss3)"}, | ||
{field: "azureBlobStorage", description: "Azure Blob Storage configuration for accessing storage", scheme: "[AzureBlobStorage](#azureblobstorage)"}, | ||
{field: "clickhouseURL", description: "ClickHouse connection URL in format: clickhouse://<user>:<password>@<host>:<port>/<database>?param1=value1¶m2=value2", scheme: "string"}, | ||
{field: "query", description: "Query to execute", scheme: "string", required: true} | ||
]}/> | ||
|
||
|
||
## AWSS3 | ||
|
||
<Fields connection="aws" rows={[ | ||
{field: "bucket", description: "AWS S3 bucket name", scheme: "string"}, | ||
{field: "path", description: "Path within the S3 bucket", scheme: "string"}, | ||
{field: "endpoint", description: "Custom endpoint URL for AWS S3", scheme: "string"} | ||
]}/> | ||
|
||
## AzureBlobStorage | ||
|
||
<Fields connection="azure" rows={[ | ||
{field: "account", description: "Azure storage account name", scheme: "string"}, | ||
{field: "container", description: "Azure Blob Storage container name", scheme: "string"}, | ||
{field: "path", description: "Path within the container", scheme: "string"}, | ||
{field: "endpointSuffix", description: "Azure endpoint suffix", scheme: "string"}, | ||
{field: "collectionName", description: "Name of the collection in Clickhouse. See [Named Collections](https://clickhouse.com/docs/operations/named-collections)", scheme: "string", required: true} | ||
]}/> |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update this so that it reflects actual azure audit logs