-
-
Notifications
You must be signed in to change notification settings - Fork 68
Installation & Usage
Lorenzo Mangani edited this page Apr 18, 2022
·
28 revisions
This wiki page will help new users install and activate their clickhouse-powered cLoki
as a service
If you use Docker, just add our container to your stack and send traffic. cLoki instances are stateless and load-balancer friendly.
cloki:
image: qxip/cloki:latest
ports:
- "3100:3100"
environment:
- CLICKHOUSE_SERVER=http://user:pass@clickhouse:8123
- For Docker extended instructions see our included example or minio/s3 example
The following requirements must be in place before proceeding:
-
clickhouse-server
server w/ HTTP + authentication -
nodejs
14.x or 16.x w/npm
installed
Install cloki
and pm2
using npm
sudo npm install -g cloki pm2
Start cloki
with pm2
and connect using your clickhouse-server
instance details (ip/hostname and authentication)
cd $(dirname $(readlink -f `which cloki`)) \
&& CLICKHOUSE_SERVER="localhost" CLICKHOUSE_AUTH="default:password" CLICKHOUSE_DB="cloki" \
pm2 start cloki --name "cloki"
Alternatively, cloki instances can be initiated and managed using pm2 ecosystem files
module.exports = {
apps : [{
name : "cloki_custom",
script : "cd $(dirname $(readlink -f `which cloki`)) && ./cloki.js",
env: {
"UUID": "cloki_custom",
"CLICKHOUSE_SERVER": "localhost",
"CLICKHOUSE_PORT": 8123,
"CLICKHOUSE_AUTH": "default:password",
"CLICKHOUSE_DB": "cloki_custom",
"CLOKI_USER": "demo",
"CLOKI_PASSWORD": "demo",
"LABELS_DAYS": 7,
"SAMPLES_DAYS": 7,
"PORT": 3100,
"DEBUG": false
}
}]
}
Check the status of your service
pm2 status cloki
No errors? Great! Save your service and enable it for startup
pm2 save
pm2 startup
Your cloki
instance should now be running, ready to write/read logs or access any clickhouse table for metrics
- Insert logs using any supported Agent
- Query cLoki using the Integrated View UI using your browser
- Query cLoki using the vLogQL CLI using your console
- Connect cLoki to Grafana using the native Loki Datasource
- Start using LogQL
- Configure Alerting Rules
- Generate Timeseries from any table