Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add options for file audit configuration #734

Merged
merged 3 commits into from Oct 29, 2018
Merged

Conversation

jnummelin
Copy link
Contributor

fixes #733

File audit logging can be configured with:

audit:
  file:
    path: /var/log/kube_audit/audit.json
    max_size: 100
    max_age: 30
    max_backups: 20

This also moves the webhook audit under audit.webhook which is a breaking change.

@jnummelin jnummelin added this to the 2.0.0 milestone Oct 29, 2018
@jakolehm jakolehm added the enhancement New feature or request label Oct 29, 2018
Copy link
Contributor

@jakolehm jakolehm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few questions:

  • why not enable this by default?
  • can user configure both file & webhook audit

@kke kke changed the title add options for file audit configuration Add options for file audit configuration Oct 29, 2018
@jnummelin
Copy link
Contributor Author

why not enable this by default?

Audit generates quite a bit of data. E.g. in my cold-running test cluster it generates ~80M per hour. So I thought one should not really have it unless you really want the have audit

can user configure both file & webhook audit

Yes.

@jakolehm
Copy link
Contributor

Audit generates quite a bit of data. E.g. in my cold-running test cluster it generates ~80M per hour. So I thought one should not really have it unless you really want the have audit

Does it really matter if we have sane defaults for size & max_age? Writing audit log to a file should not be too resource intensive?

@jnummelin
Copy link
Contributor Author

jnummelin commented Oct 29, 2018

Does it really matter if we have sane defaults for size & max_age? Writing audit log to a file should not be too resource intensive?

We can make it on by default. How about with something like:

          'path' => '/var/log/kubernetes/audit.json',
          'max_size' => 100, # Max 100M files
          'max_age' => 30, # Max 30 days old audits
          'max_backups' => 20 # Max 20 rolled files, each 100M --> 2G used at max

That would make it look like something like this on disk:

root@pharos-master-0:~# ls -lah /var/log/kubernetes/
total 101M
drwxr-xr-x  2 root root   4.0K Oct 29 11:19 .
drwxrwxr-x 10 root syslog 4.0K Oct 29 09:15 ..
-rw-r--r--  1 root root   100M Oct 29 11:19 audit-2018-10-29T11-19-02.698.json
-rw-r--r--  1 root root   271K Oct 29 11:19 audit.json

@jnummelin
Copy link
Contributor Author

@jakolehm there's now defaulting in place PTAL

'path' => '/var/log/kubernetes/audit.json',
'max_size' => 100, # Max 100M files
'max_age' => 30, # Max 30 days old audits
'max_backups' => 20 # Max 20 rolled files, each 100M
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add a comment how much in total audit logs can consume.

Copy link
Contributor

@jakolehm jakolehm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jakolehm jakolehm merged commit f2e4226 into master Oct 29, 2018
@jakolehm jakolehm deleted the feature/audit-logging branch October 29, 2018 14:36
@jakolehm jakolehm mentioned this pull request Oct 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enable audit logging by default
2 participants