graylog
by KongZ
Graylog is the centralized log management solution built to open standards for capturing, storing, and enabling real-time analysis of terabytes of machine data.
About this chart
Graylog
This chart provide the [Graylog][1] deployments. Note: It is strongly recommend to use on Official Graylog image to run this chart.
Quick Installation
This chart requires the following charts before install Graylog
- MongoDB
- Opensearch
Since chart version 2.5.0, we replaced Bitnami MongoDB with the official MongoDB image. You must manually install the MongoDB Operator CRD before installing the Graylog chart with dependencies.
Install MongoDB CRDs only first installation. You can skip CRD step when upgrade.
helm install --create-namespace --namespace graylog community-operator-crds mongodb/community-operator-crds
To install the Graylog Chart with all dependencies
helm install --create-namespace --namespace graylog graylog kongz/graylog
Manually Install Dependencies
This method is recommended when you want to expand the availability, scalability, and security of the services. You need to install MongoDB replicaset and Opensearch with proper settings before install Graylog.
To install MongoDB, run
helm install --create-namespace --namespace graylog community-operator-crds mongodb/community-operator-crds
And then apply the following MongoDBCommunity manifest.
kubectl apply -f <graylog-mongodb.yaml>
The sample configuration for MongoDB setup for Graylog.
apiVersion: mongodbcommunity.mongodb.com/v1
kind: MongoDBCommunity
metadata:
name: graylog-mongodb
spec:
members: 3
security:
authentication:
modes:
- SCRAM
type: ReplicaSet
users:
- db: graylog
name: graylog
passwordSecretRef:
name: graylog-mongodb
roles:
- db: graylog
name: readWrite
- db: graylog
name: dbAdmin
- db: admin
name: clusterMonitor
scramCredentialsSecretName: graylog
version: 6.0.25
For complete MongoDB Operator installation separately, see mongodb-kubernetes-operator
Note: There are many alternative MongoDB available on artifacthub.io. If you found the mongodb community operator is not suitable, you can use another MongoDB chart. Modify graylog.mongodb.uri to match your MongoDB endpoint.
You can specify how Graylog picks the MongoDB connection in this order:
- If
graylog.mongodb.uriis specified, it will use this value. - If
graylog.mongodb.uriSecretKeyis specified, it will use the secretgraylog.mongodb.uriSecretName. - If
mongodb.community.installistrueand neithergraylog.mongodb.urinorgraylog.mongodb.uriSecretKeyis used, it will use the secret generated from the MongoDB Operator.
MongoDB roles for an external database
If you bring your own MongoDB (tags.install-mongodb=false), the Graylog user needs more than readWrite. Grant these roles on the existing user (replace grayloguser if your username differs):
| Role | Database | Why |
|---|---|---|
readWrite | graylog | Read and write Graylog application data |
dbAdmin | graylog | Required from Graylog 7.2: startup runs collMod / convertToCapped on cluster_events. Without this role the pod fails with Unauthorized on collMod |
clusterMonitor | admin | Cluster configuration and node stats in the Graylog UI |
use graylog
db.grantRolesToUser("grayloguser", [
{ role: "readWrite", db: "graylog" },
{ role: "dbAdmin", db: "graylog" },
{ role: "clusterMonitor", db: "admin" }
])
If the user already has readWrite, you can add the missing roles one at a time:
use graylog
db.grantRolesToUser("grayloguser", [{ role: "clusterMonitor", db: "admin" }])
db.grantRolesToUser("grayloguser", [{ role: "dbAdmin", db: "graylog" }])
Restart Graylog pods after changing roles.
To install Opensearch, run
helm repo add opensearch https://opensearch-project.github.io/helm-charts/
helm install --namespace "graylog" opensearch opensearch/opensearch
The Opensearch installation command above will install all Opensearch nodes types in single node. It is strongly recommend to follow the Opensearch guide to install dedicated node on production.
Note: There are many alternative Opensearch available on artifacthub.io. If you found the stable/opensearch is not suitable, you can search other charts from GitHub repositories.
Install Chart
To install the Graylog Chart into your Kubernetes cluster (This Chart requires persistent volume by default, you may need to create a storage class before install chart.
helm install --namespace "graylog" graylog kongz/graylog \
--set tags.install-mongodb=false\
--set tags.install-opensearch=false\
--set graylog.mongodb.uri=mongodb://mongodb-mongodb-replicaset-0.mongodb-mongodb-replicaset.graylog.svc.cluster.local:27017/graylog?replicaSet=rs0 \
--set graylog.opensearch.hosts=http://opensearch-cluster-master-headless.graylog.svc.cluster.local:9200
After installation succeeds, you can get a status of Chart
helm status graylog
If you want to delete your Chart, use this command
helm delete graylog
Install Chart with specific Graylog cluster size
By default, this Chart will create a graylog with 2 nodes (1 master, 1 coordinating). If you want to change the cluster size during installation, you can use --set graylog.replicas={value} argument. Or edit values.yaml
For example: Set cluster size to 5
helm install --namespace "graylog" graylog --set graylog.replicas=5 kongz/graylog
The command above will install 1 master and 4 coordinating.
Install Chart with specific node pool
Sometime you may need to deploy your graylog to specific node pool to allocate resources.
Using node selector
For example, you have 6 vms in node pools and you want to deploy graylog to node which labeled as cloud.google.com/gke-nodepool: graylog-pool
Set the following values in values.yaml
graylog:
nodeSelector: { cloud.google.com/gke-nodepool: graylog-pool }
Using tolerations
For example, you have 6 vms in node pools and 3 nodes are tainted with NO_SCHEDULE graylog=true
Set the following values in values.yaml
graylog:
tolerations:
- key: graylog
value: "true"
operator: "Equal"
Configuration
The following table lists the configurable parameters of the Graylog chart and their default values.
| Parameter | Description | Default |
|---|---|---|
graylog.image.repository | graylog image repository | graylog/graylog |
graylog.image.tag | graylog image tag | 4.2.7-1 |
graylog.image.pullPolicy | Image pull policy | IfNotPresent |
graylog.replicas | The number of Graylog instances in the cluster. The chart will automatic create assign master to one of replicas | 2 |
graylog.resources | CPU/Memory resource requests/limits | Memory: 1024Mi, CPU: 500m |
graylog.heapSize | Override Java heap size. If this value empty, chart will allocate heap size using -XX:+UseCGroupMemoryLimitForHeap | |
graylog.externalUri | External URI that Graylog is available at | |
graylog.nodeSelector | Graylog server pod assignment | {} |
graylog.affinity | Graylog server affinity | {} |
graylog.tolerations | Graylog server tolerations | [] |
graylog.nodeSelector | Graylog server node selector | {} |
graylog.env | Graylog server env variables | {} |
graylog.customLabels | Graylog additional labels for statefulset/pods | {} |
graylog.envRaw | Graylog server env variables in raw yaml format | {} |
graylog.podSecurityContext | Set security context for defining privilege and accessing control settings entire Pod | {} |
graylog.securityContext | Set security context for defining privilege and accessing control settings for Graylog container | privileged: false |
graylog.javaOpts | Graylog service JAVA_OPTS | |
Graylog service additional JAVA_OPTS (Replaced with graylog.javaOpts) | ||
graylog.service.type | Kubernetes Service type | ClusterIP |
graylog.service.port | Graylog Service port | 9000 |
graylog.service.ports | Graylog Service extra ports | [] |
graylog.service.master.enabled | If true, Graylog Master Service will be created | true |
graylog.service.master.port | Graylog Master Service port | 9000 |
graylog.service.master.type | Graylog Master Service type | ClusterIP |
graylog.service.master.annotations | Graylog Master Service annotations | {} |
graylog.service.headless.suffix | If present, suffix appended to the name of the chart to form the headless service name, ie: -headless would result in graylog-headless | |
graylog.podAnnotations | Kubernetes Pod annotations | {} |
graylog.priorityClassName | If specified, indicates the pod's priority. | `` |
graylog.terminationGracePeriodSeconds | Pod termination grace period | 120 |
| `graylog.updateS |
Deploy graylog with OpenTenant
Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has graylog on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.
- Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
- Place the chartgraylog is pinned at v3.1.2 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
- ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below opentenant validate opentenant.yaml terraform init && terraform apply