Skip to content

Commit

Permalink
correct log level docs (#1153)
Browse files Browse the repository at this point in the history
  • Loading branch information
mittal-ishaan authored Dec 6, 2024
1 parent ca60bc8 commit 3da349a
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions troubleshooting/troubleshoot-install.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,12 @@ kubectl logs deployment/kubecost-cost-analyzer -c cost-model

Alternatively, Lens is a great tool for diagnosing many issues in a single view. See our blog post on [using Lens with Kubecost](https://blog.kubecost.com/blog/lens-kubecost-extension/) to learn more.

## Configuring log levels
## Configuring Log Levels

The log output can be adjusted while deploying through Helm by using the `LOG_LEVEL` and/or `LOG_FORMAT` environment variables. These variables include:
You can adjust the log output while deploying through Helm by using the `logLevel` property and/or the `LOG_FORMAT` environment variable.

### Adjusting Log Level
Adjusting the log level increases or decreases the level of verbosity written to the logs. The `logLevel` property accepts the following values:

* `trace`
* `debug`
Expand All @@ -65,15 +68,18 @@ For example, to set the log level to `debug`, add the following flag to the Helm

{% code overflow="wrap" %}
```bash
--set 'kubecostModel.extraEnv[0].name=LOG_LEVEL,kubecostModel.extraEnv[0].value=debug'
--set 'kubecostModel.logLevel=debug'
```
{% endcode %}

You can set `LOG_LEVEL` to generate two different outputs.
### Adjusting Log Format

Setting it to `JSON` will generate a structured logging output: `{"level":"info","time":"2006-01-02T15:04:05.999999999Z07:00","message":"Starting cost-model (git commit \"1.91.0-rc.0\")"}`
Adjusting the log format changes the format in which the logs are output making it easier for log aggregators to parse and display logged messages. The `LOG_FORMAT` environment variable accepts the values `JSON`, for a structured output, and `pretty` for a nice, human-readable output.

Setting `LOG_LEVEL` to `pretty` will generate a nice human-readable output: `2006-01-02T15:04:05.999999999Z07:00 INF Starting cost-model (git commit "1.91.0-rc.0")`
| Value | Output |
|--------|----------------------------------------------------------------------------------------------------------------------------|
| `JSON` | `{"level":"info","time":"2006-01-02T15:04:05.999999999Z07:00","message":"Starting cost-model (git commit \"1.91.0-rc.0\")"}` |
| `pretty` | `2006-01-02T15:04:05.999999999Z07:00 INF Starting cost-model (git commit "1.91.0-rc.0")` |

### Temporarily set log level

Expand Down

0 comments on commit 3da349a

Please sign in to comment.