# 2021-11-17-15:06:00+0800 Change and configure slow log

- Cause:

Due to a bug of Slowlog, the size of the slowlog has caused disk pressure hence brought the TiDB container done during a backup process.

- Operation:

``` sh
mysql> set tidb_slow_log_threshold = 5000;
```

Clean up the logs of slowlog. This is done by mounting the `/var/lib/docker` directory.

```yaml
kind: DaemonSet
apiVersion: apps/v1
metadata:
  namespace: tidb1379661944584424071
  name: startup-script
  labels:
    app: startup-script
spec:
  selector:
    matchLabels:
      name: startup-script
  template:
    metadata:
      labels:
        name: startup-script
    spec:
      nodeSelector:
        kubernetes.io/hostname: ip-10-242-87-134.ap-southeast-1.compute.internal
      hostPID: true
      tolerations:
      - effect: NoSchedule
        operator: Exists
      - key: CriticalAddonsOnly
        operator: Exists
      - effect: NoExecute
        operator: Exists
      containers:
        - name: startup-script
          image: gcr.io/google-containers/startup-script:v1
          imagePullPolicy: Always
          securityContext:
            privileged: true
          env:
          - name: STARTUP_SCRIPT
            value: |
              #! /bin/bash
              set -o errexit
              set -o pipefail
              set -o nounset
              echo start
              sleep 3600
          volumeMounts:
          - mountPath: /var/lib/docker
            name: docker
      volumes:
      - name: docker
        hostPath:
          # directory location on host
          path: /var/lib/docker
          # this field is optional
          type: Directory
```

```sh
kubectl exec --stdin --tty -n tidb1379661944584424071 startup-script-vfzx4 -- /bin/sh
rm /var/lib/docker/containers/0fc1ec9f18ac7b56ec73c04f289452898a15fbb7c7a55ba2696fa159d8a6d5f1/*.gz
```

- Impact:

Slowlog now only records the queries that take more than 5000ms to execute.

- Recovery operation:

N/A

- Time window:

2021-11-17 15:07 ~ 16:11 CST
