kubernetes-csi/external-provisioner

Why can't I print logs to a file?

silence-coding opened this issue · 2 comments

Why can't I print logs to a file?
csi-provisioner v3.0.0

          args:
            - "--csi-address=$(CSI_ENDPOINT)"
            - "--v=5"
            - "--feature-gates=Topology=true"
            - "--strict-topology=true"
            - "--extra-create-metadata=true"
            - "--default-fstype=ext4"
            - "--log_file=/csi/provisioner.log"
            - "--log_file_max_size=1800"
[root@k8s-master csi-driver]# ./external-provisioner/workspace/docker/usr/local/bin/csi-provisioner --help
Usage of ./external-provisioner/workspace/docker/usr/local/bin/csi-provisioner:
      --add_dir_header                            If true, adds the file directory to the header of the log messages
      --alsologtostderr                           log to standard error as well as files
      --capacity-for-immediate-binding            Enables producing capacity information for storage classes with immediate binding. Not needed for the Kubernetes scheduler, maybe useful for other consumers or for debugging.
      --capacity-ownerref-level int               The level indicates the number of objects that need to be traversed starting from the pod identified by the POD_NAME and NAMESPACE environment variables to reach the owning object for CSIStorageCapacity objects: -1 for no owner, 0 for the pod itself, 1 for a StatefulSet or DaemonSet, 2 for a Deployment, etc. (default 1)
      --capacity-poll-interval duration           How long the external-provisioner waits before checking for storage capacity changes. (default 1m0s)
      --capacity-threads uint                     Number of simultaneously running threads, handling CSIStorageCapacity objects (default 1)
      --cloning-protection-threads uint           Number of simultaneously running threads, handling cloning finalizer removal (default 1)
      --controller-publish-readonly               This option enables PV to be marked as readonly at controller publish volume call if PVC accessmode has been set to ROX.
      --csi-address string                        The gRPC endpoint for Target CSI Volume. (default "/run/csi/socket")
      --default-fstype string                     The default filesystem type of the volume to provision when fstype is unspecified in the StorageClass. If the default is not set and fstype is unset in the StorageClass, then no fstype will be set
      --enable-capacity                           This enables producing CSIStorageCapacity objects with capacity information from the driver's GetCapacity call.
      --extra-create-metadata                     If set, add pv/pvc metadata to plugin create requests as parameters.
      --feature-gates mapStringBool               A set of key=value pairs that describe feature gates for alpha/experimental features. Options are:
                                                  AllAlpha=true|false (ALPHA - default=false)
                                                  AllBeta=true|false (BETA - default=false)
      --http-endpoint :8080                       The TCP network address where the HTTP server for diagnostics, including metrics and leader election health check, will listen (example: :8080). The default is empty string, which means the server is disabled. Only one of `--metrics-address` and `--http-endpoint` can be set.
      --immediate-topology                        Immediate binding: pass aggregated cluster topologies for all nodes where the CSI driver is available (enabled, the default) or no topology requirements (if disabled). (default true)
      --kube-api-burst int                        Burst to use while communicating with the kubernetes apiserver. Defaults to 10. (default 10)
      --kube-api-qps float32                      QPS to use while communicating with the kubernetes apiserver. Defaults to 5.0. (default 5)
      --kubeconfig string                         Absolute path to the kubeconfig file. Either this or master needs to be set if the provisioner is being run out of cluster.
      --leader-election                           Enables leader election. If leader election is enabled, additional RBAC rules are required. Please refer to the Kubernetes CSI documentation for instructions on setting up these RBAC rules.
      --leader-election-lease-duration duration   Duration, in seconds, that non-leader candidates will wait to force acquire leadership. Defaults to 15 seconds. (default 15s)
      --leader-election-namespace string          Namespace where the leader election resource lives. Defaults to the pod namespace if not set.
      --leader-election-renew-deadline duration   Duration, in seconds, that the acting leader will retry refreshing leadership before giving up. Defaults to 10 seconds. (default 10s)
      --leader-election-retry-period duration     Duration, in seconds, the LeaderElector clients should wait between tries of actions. Defaults to 5 seconds. (default 5s)
      --log_backtrace_at traceLocation            when logging hits line file:N, emit a stack trace (default :0)
      --log_dir string                            If non-empty, write log files in this directory
      --log_file string                           If non-empty, use this log file
      --log_file_max_size uint                    Defines the maximum size a log file can grow to. Unit is megabytes. If the value is 0, the maximum file size is unlimited. (default 1800)
      --logtostderr                               log to standard error instead of files (default true)
      --master string                             Master URL to build a client config from. Either this or kubeconfig needs to be set if the provisioner is being run out of cluster.
      --metrics-address :8080                     (deprecated) The TCP network address where the prometheus metrics endpoint will listen (example: :8080). The default is empty string, which means metrics endpoint is disabled. Only one of `--metrics-address` and `--http-endpoint` can be set.
      --metrics-path /metrics                     The HTTP path where prometheus metrics will be exposed. Default is /metrics. (default "/metrics")
      --node-deployment                           Enables deploying the external-provisioner together with a CSI driver on nodes to manage node-local volumes.
      --node-deployment-base-delay duration       Determines how long the external-provisioner sleeps initially before trying to own a PVC with immediate binding. (default 20s)
      --node-deployment-immediate-binding         Determines whether immediate binding is supported when deployed on each node. (default true)
      --node-deployment-max-delay duration        Determines how long the external-provisioner sleeps at most before trying to own a PVC with immediate binding. (default 1m0s)
      --one_output                                If true, only write logs to their native severity level (vs also writing to each lower severity level)
      --retry-interval-max duration               Maximum retry interval of failed provisioning or deletion. (default 5m0s)
      --retry-interval-start duration             Initial retry interval of failed provisioning or deletion. It doubles with each failure, up to retry-interval-max. (default 1s)
      --skip_headers                              If true, avoid header prefixes in the log messages
      --skip_log_headers                          If true, avoid headers when opening log files
      --stderrthreshold severity                  logs at or above this threshold go to stderr (default 2)
      --strict-topology                           Late binding: pass only selected node topology to CreateVolume Request, unlike default behavior of passing aggregated cluster topologies that match with topology keys of the selected node.
      --timeout duration                          Timeout for waiting for creation or deletion of a volume (default 10s)
  -v, --v Level                                   number for the log level verbosity
      --version                                   Show version.
      --vmodule moduleSpec                        comma-separated list of pattern=N settings for file-filtered logging
      --volume-name-prefix string                 Prefix to apply to the name of a created volume. (default "pvc")
      --volume-name-uuid-length int               Truncates generated UUID of a created volume to this length. Defaults behavior is to NOT truncate. (default -1)
      --worker-threads uint                       Number of provisioner worker threads, in other words nr. of simultaneous CSI calls. (default 100)
pflag: help requested

pohly commented

You need to disable printing to stderr with --logtostderr=false.