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

Audit log formatter #3611

Merged
merged 2 commits into from
Mar 7, 2024
Merged

Conversation

dbutenhof
Copy link
Member

Another late night ops side project: this queries the Audit log with filters and displays the results either in detail or summary, optionally with pagination.

/opt/pbench-server/bin/pbench-audit --since 2024-02-29 --until 2024-03-01 --name upload --summary
[...]
[2024-02-29 19:35:07] upload uperf_HyperV_RHEL-9.4.0-20240225.8_x86_64_gen2_hv_netvsc_quick_D240227T172431_2024.02.27T09.24.31 FAILURE (legacy) [2.584 seconds]
[2024-02-29 19:36:09] upload uperf_HyperV_RHEL-9.4.0-20240225.8_x86_64_gen2_hv_netvsc_quick_D240227T172431_2024.02.27T09.24.31 SUCCESS (legacy) [4.093 seconds]
Reported 428 audit events:
         BEGIN        214
       SUCCESS         24
       FAILURE        190

Or (full form):

/opt/pbench-server/bin/pbench-audit -C /opt/pbench-server/lib/config/pbench-server.cfg --since 2024-02-29T12:00:00 --until '2024-02-29 19:00:00' --name upload
[...]
  [2024-02-29 18:58:09.608043+00:00] : upload BEGIN
    DATASET uperf_HyperV_RHEL-9.4.0-20240225.8_x86_64_gen2_hv_netvsc_quick_D240227T172431_2024.02.27T09.24.31 by user legacy
      {'access': 'public', 'metadata': {'global.server.legacy.version': '0.69.11', 'global.server.legacy.sha1': '29bf18093', 'global.server.legacy.hostname': 'n010.intlab.redhat.com'}}
  [2024-02-29 18:58:12.279230+00:00] : upload FAILURE [2.671 seconds]
    DATASET uperf_HyperV_RHEL-9.4.0-20240225.8_x86_64_gen2_hv_netvsc_quick_D240227T172431_2024.02.27T09.24.31 by user legacy
      {'message': "A tarball with the name 'uperf_HyperV_RHEL-9.4.0-20240225.8_x86_64_gen2_hv_netvsc_quick_D240227T172431_2024.02.27T09.24.31' already exists"}
  [2024-02-29 18:59:05.843728+00:00] : upload BEGIN
    DATASET uperf_HyperV_RHEL-9.4.0-20240225.8_x86_64_gen2_hv_netvsc_quick_D240227T172431_2024.02.27T09.24.31 by user legacy
      {'access': 'public', 'metadata': {'global.server.legacy.version': '0.69.11', 'global.server.legacy.sha1': '29bf18093', 'global.server.legacy.hostname': 'n010.intlab.redhat.com'}}
  [2024-02-29 18:59:08.592574+00:00] : upload FAILURE [2.749 seconds]
    DATASET uperf_HyperV_RHEL-9.4.0-20240225.8_x86_64_gen2_hv_netvsc_quick_D240227T172431_2024.02.27T09.24.31 by user legacy
      {'message': "A tarball with the name 'uperf_HyperV_RHEL-9.4.0-20240225.8_x86_64_gen2_hv_netvsc_quick_D240227T172431_2024.02.27T09.24.31' already exists"}
Reported 354 audit events:
         BEGIN        177
       SUCCESS         23
       FAILURE        154

Another late night ops side project: this queries the `Audit` log with filters
and displays the results either in detail or summary, optionally with
pagination.

```
/opt/pbench-server/bin/pbench-audit --since 2024-02-29 --until 2024-03-01 --name upload --summary
[...]
[2024-02-29 19:35:07] upload uperf_HyperV_RHEL-9.4.0-20240225.8_x86_64_gen2_hv_netvsc_quick_D240227T172431_2024.02.27T09.24.31 FAILURE (legacy) [2.584 seconds]
[2024-02-29 19:36:09] upload uperf_HyperV_RHEL-9.4.0-20240225.8_x86_64_gen2_hv_netvsc_quick_D240227T172431_2024.02.27T09.24.31 SUCCESS (legacy) [4.093 seconds]
Reported 428 audit events:
         BEGIN        214
       SUCCESS         24
       FAILURE        190
```

Or (full form):

```
/opt/pbench-server/bin/pbench-audit -C /opt/pbench-server/lib/config/pbench-server.cfg --since 2024-02-29T12:00:00 --until '2024-02-29 19:00:00' --name upload
[...]
  [2024-02-29 18:58:09.608043+00:00] : upload BEGIN
    DATASET uperf_HyperV_RHEL-9.4.0-20240225.8_x86_64_gen2_hv_netvsc_quick_D240227T172431_2024.02.27T09.24.31 by user legacy
      {'access': 'public', 'metadata': {'global.server.legacy.version': '0.69.11', 'global.server.legacy.sha1': '29bf18093', 'global.server.legacy.hostname': 'n010.intlab.redhat.com'}}
  [2024-02-29 18:58:12.279230+00:00] : upload FAILURE [2.671 seconds]
    DATASET uperf_HyperV_RHEL-9.4.0-20240225.8_x86_64_gen2_hv_netvsc_quick_D240227T172431_2024.02.27T09.24.31 by user legacy
      {'message': "A tarball with the name 'uperf_HyperV_RHEL-9.4.0-20240225.8_x86_64_gen2_hv_netvsc_quick_D240227T172431_2024.02.27T09.24.31' already exists"}
  [2024-02-29 18:59:05.843728+00:00] : upload BEGIN
    DATASET uperf_HyperV_RHEL-9.4.0-20240225.8_x86_64_gen2_hv_netvsc_quick_D240227T172431_2024.02.27T09.24.31 by user legacy
      {'access': 'public', 'metadata': {'global.server.legacy.version': '0.69.11', 'global.server.legacy.sha1': '29bf18093', 'global.server.legacy.hostname': 'n010.intlab.redhat.com'}}
  [2024-02-29 18:59:08.592574+00:00] : upload FAILURE [2.749 seconds]
    DATASET uperf_HyperV_RHEL-9.4.0-20240225.8_x86_64_gen2_hv_netvsc_quick_D240227T172431_2024.02.27T09.24.31 by user legacy
      {'message': "A tarball with the name 'uperf_HyperV_RHEL-9.4.0-20240225.8_x86_64_gen2_hv_netvsc_quick_D240227T172431_2024.02.27T09.24.31' already exists"}
Reported 354 audit events:
         BEGIN        177
       SUCCESS         23
       FAILURE        154
```
@dbutenhof dbutenhof added Server Audit Of and relating to server side changes to data CLI Of and relating to the CLI interface to pbench Operations Related to operation and monitoring of a service labels Mar 6, 2024
@dbutenhof dbutenhof requested a review from webbnh March 6, 2024 13:18
@dbutenhof dbutenhof self-assigned this Mar 6, 2024
webbnh
webbnh previously approved these changes Mar 6, 2024
Copy link
Member

@webbnh webbnh left a comment

Choose a reason for hiding this comment

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

Seems very cool, and it looks like it was nice and fairly easy to write.

server/Makefile Outdated Show resolved Hide resolved
lib/pbench/cli/server/audit.py Show resolved Hide resolved
lib/pbench/cli/server/audit.py Show resolved Hide resolved
lib/pbench/cli/server/audit.py Outdated Show resolved Hide resolved
lib/pbench/cli/server/audit.py Show resolved Hide resolved
Copy link
Member

@webbnh webbnh left a comment

Choose a reason for hiding this comment

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

👍

lib/pbench/cli/server/audit.py Show resolved Hide resolved
@dbutenhof dbutenhof merged commit 12710f1 into distributed-system-analysis:main Mar 7, 2024
4 checks passed
@dbutenhof dbutenhof deleted the auditutil branch March 7, 2024 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Audit Of and relating to server side changes to data CLI Of and relating to the CLI interface to pbench Operations Related to operation and monitoring of a service Server
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants