Skip to content
This repository has been archived by the owner on Oct 30, 2024. It is now read-only.

How to fetch Kubeaudit output in text file? #357

Closed
ridhika1628 opened this issue Aug 24, 2021 · 6 comments
Closed

How to fetch Kubeaudit output in text file? #357

ridhika1628 opened this issue Aug 24, 2021 · 6 comments

Comments

@ridhika1628
Copy link

I am trying to run below command

kubeaudit all

Want to get the output in some text file so that if there are "level=error" in auditing will make it as fail.

@ghost
Copy link

ghost commented Aug 24, 2021

Thanks for opening your first issue here! Be sure to follow the issue template!

@genevieveluyt
Copy link
Contributor

Hi @ridhika1628 ,

Kubeaudit exits with exit code 2 (customizable via the exitcode flag) if there are any errors, so if you're running it in a script you can determine if kubeaudit passed or failed that way.

If you want to write the Kubeaudit output to file you can redirect the output to a file:

kubeaudit all --format json > output.txt

Does that work for you?

@ridhika1628
Copy link
Author

H @genevieveluyt, I tried running that command but no luck.

Getting below error

Error: unknown flag: --format

Usage:
  kubeaudit all [flags]

Flags:
  -h, --help   help for all

Global Flags:
  -a, --allPods              Audit againsts pods in all the phases (default Running Phase)
  -k, --auditconfig string   filepath for kubeaudit config file
  -j, --json                 Enable json logging
  -c, --kubeconfig string    Specify local config file (default is $HOME/.kube/config)
  -l, --local                [DEPRECATED] Local mode, uses $HOME/.kube/config as configuration
  -f, --manifest string      yaml configuration to audit
  -n, --namespace string     Specify the namespace scope to audit
  -v, --verbose string       Set the debug level (default "INFO")

@genevieveluyt
Copy link
Contributor

It looks like you're using an older version of kubeaudit. Can you follow the installation instructions to install the latest version of kubeaudit? You'll know you have the right one if you can run the version command:

$ kubeaudit version
0.14.2

@genevieveluyt
Copy link
Contributor

@ridhika1628 do you still need help with this?

@genevieveluyt
Copy link
Contributor

Closing this issue due to inactivity but @ridhika1628 feel free to reopen if you are still experiencing issues.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants