# Disable operationProfiling when using operator in k8s

**URL:** https://forums.percona.com/t/disable-operationprofiling-when-using-operator-in-k8s/15406
**Category:** Percona Operator for MongoDB
**Tags:** mongodb
**Created:** [April 26, 2022, 11:49am UTC](https://forums.percona.com/t/disable-operationprofiling-when-using-operator-in-k8s/15406 "2022-04-26T11:49:21Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Ivan\_Artemov](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/ivan_artemov/32/6405_2.png) [@Ivan\_Artemov](https://forums.percona.com/u/Ivan_Artemov)
#### Post date: [April 26, 2022, 11:49am UTC](https://forums.percona.com/t/disable-operationprofiling-when-using-operator-in-k8s/15406/1 "2022-04-26T11:49:21Z")

</div>

Good afternoon,

There was a problem using percona-server-mongodb-operator:1.11.0. Specifically, the problem is with the operationProfiling parameter. Here is an example for configuring a mongoDB instance:

```auto
---
apiVersion: psmdb.percona.com/v1-12-0
kind: PerconaServerMongoDB
metadata:
  name: test-mongo
spec:
  crVersion: 1.11.0
  image: percona/percona-server-mongodb:4.4.12
  allowUnsafeConfigurations: true
  updateStrategy: SmartUpdate
  upgradeOptions:
    apply: Never
  secrets:
    users: user-secrets
  pmm:
    enabled: false
  replsets:
  - name: rs0
    size: 1
    expose:
      enabled: false
    volumeSpec:
      persistentVolumeClaim:
        storageClassName: test
        resources:
          requests:
            storage: 1Gi
    resources:
      limits:
        memory: 1Gi
      requests:
        cpu: 50m
        memory: 1Gi
    arbiter:
      enabled: false
    sharding:
      enabled: false

```

In this case, an instance will be deployed in mongodb which will have the following command to start the mongodb process:

```auto
mongod --bind_ip_all --auth --dbpath=/data/db --port=27017 --replSet=rs0 --storageEngine=wiredTiger --relaxPermChecks --clusterAuthMode=keyFile --keyFile=/etc/mongodb-secrets/mongodb-key --slowms=0 --profile=1 --enableEncryption --encryptionKeyFile=/etc/mongodb-encryption/encryption-key --wiredTigerCacheSizeGB=0.25 --wiredTigerIndexPrefixCompression=true --config=/etc/mongodb-config/mongod.conf --tlsAllowInvalidCertificates

```

In a similar configuration, the monga will start with two parameters **–slowms=0 --profile=1**.  
What does logging of all operations mean and how in our case it led to a huge number of logs.

According to your documentation, I can do similar configuration for two parameters such as **operationProfiling** and **systemLog** like this:

```auto
configuration: |
  operationProfiling:
     mode: off
   systemLog:
     verbosity: 0

```

But this did not work because these two parameters were still in the launch command, although my parameters were written to the config.

The problem with a large number of logs due to the included operationProfiling needed to be solved. In the end, I came to such a decision and substituted the following construction in the spec:

```auto
mongod:
  operationProfiling:
    enabled: false

```

This design helped me to avoid running mongoDB with the **–slowms=0** and **–profile=1** parameters.

```auto
mongod --bind_ip_all --auth --dbpath=/data/db --port=27017 --replSet=rs0 --storageEngine=wiredTiger --relaxPermChecks --clusterAuthMode=keyFile --keyFile=/etc/mongodb-secrets/mongodb-key --enableEncryption --encryptionKeyFile=/etc/mongodb-encryption/encryption-key --wiredTigerCacheSizeGB=0.25 --wiredTigerIndexPrefixCompression=true --tlsAllowInvalidCertificates

```

 ![1](https://us1.discourse-cdn.com/flex019/uploads/percona1/original/2X/1/1b0295e2f14c00aeb515e23c858f40d03b9cdb9c.png)

I had to come up with this solution to the problem myself, since there is nothing in the documentation for configuring the **operationProfiling** parameter. In my opinion, if we do not configure the current parameter at all, then we need to run mongoDB with **mode: off** for **operationProfiling**.

You have this [part of the code](https://github.com/percona/percona-server-mongodb-operator/blob/f1998d900ee6cfba371b17d3e6bd68979df87646/pkg/psmdb/container.go#L169-L183) where parameters are added to start the mongoDB process, for some reason the current scheme does not take into account at all, for example, mode: off is needed.  
Or it looks like a bug, because if the operationProfiling parameter is empty, then it should not add two parameters **–slowms=0** and **–profile=1** to the launch.

---

<div class="post-metadata">

### Author: ![Tomislav\_Plavcic](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/tomislav_plavcic/32/9717_2.png) [@Tomislav\_Plavcic](https://forums.percona.com/u/Tomislav_Plavcic)
#### Post date: [April 29, 2022, 10:44am UTC](https://forums.percona.com/t/disable-operationprofiling-when-using-operator-in-k8s/15406/2 "2022-04-29T10:44:42Z")

</div>

Hi Ivan,  
in the next release of PSMDB operator 1.12.0 (should be released in a week or two) “mongod” section in cr.yaml is getting removed and operationProfiling will need to be set in “configuration” section for replica sets. Also it will be disabled by default.
