Skip to content

Commit 5254f92

Browse files
authored
Merge pull request #35360 from dims/fix-command-line-issues-in-audit-log-parsing
fix command line issues in audit log parsing
2 parents bb6f117 + 63de373 commit 5254f92

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

config/jobs/kubernetes/sig-arch/conformance-audit.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,10 @@ presubmits:
3232
curl -sSL https://kind.sigs.k8s.io/dl/latest/linux-amd64.tgz | tar xvfz - -C "${PATH%%:*}/"
3333
&& curl -sO https://raw.githubusercontent.com/ii/kind/ci-audit-logging/hack/ci/e2e-k8s.sh
3434
&& bash e2e-k8s.sh
35-
&& python3 ./../test-infra/experiment/audit/audit_log_parser.py ${ARTIFACTS}/audit/audit*.log \
35+
&& python3 ./../test-infra/experiment/audit/audit_log_parser.py \
3636
--output "${ARTIFACTS}/audit/audit-endpoints.txt" \
37-
--swagger-url "file://$PWD/api/openapi-spec/swagger.json"
37+
--swagger-url "file://$PWD/api/openapi-spec/swagger.json" \
38+
--audit-logs ${ARTIFACTS}/audit/audit*.log
3839
env:
3940
- name: BUILD_TYPE
4041
value: docker

experiment/audit/audit_log_parser.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
Kubernetes API endpoints using the official Swagger/OpenAPI specification
2424
for accurate endpoint naming.
2525
26-
Usage: python3 audit_log_parser.py <audit_log_file> [--output <output_file>] [--swagger-url <url>]
26+
Usage: python3 audit_log_parser.py --audit-logs <audit_log_file>... [--output <output_file>] [--swagger-url <url>]
2727
"""
2828

2929
import json
@@ -602,15 +602,15 @@ def main():
602602
formatter_class=argparse.RawDescriptionHelpFormatter,
603603
epilog="""
604604
Examples:
605-
python3 audit_log_parser_swagger.py audit.log
606-
python3 audit_log_parser_swagger.py audit1.log audit2.log
607-
python3 audit_log_parser_swagger.py audit.log --output results.txt
608-
python3 audit_log_parser_swagger.py audit*.log --sort count --output results.txt
609-
python3 audit_log_parser_swagger.py audit.log --swagger-url https://custom-swagger.json
605+
python3 audit_log_parser_swagger.py --audit-logs audit.log
606+
python3 audit_log_parser_swagger.py --audit-logs audit1.log audit2.log
607+
python3 audit_log_parser_swagger.py --audit-logs audit.log --output results.txt
608+
python3 audit_log_parser_swagger.py --audit-logs audit*.log --sort count --output results.txt
609+
python3 audit_log_parser_swagger.py --audit-logs audit.log --swagger-url https://custom-swagger.json
610610
"""
611611
)
612612

613-
parser.add_argument('audit_logs', nargs='+', help='Path(s) to Kubernetes audit log file(s)')
613+
parser.add_argument('--audit-logs', nargs='+', required=True, help='Path(s) to Kubernetes audit log file(s)')
614614
parser.add_argument('-o', '--output', help='Output file (default: print to stdout)')
615615
parser.add_argument('--swagger-url', help='Custom Swagger/OpenAPI specification URL')
616616
parser.add_argument('--sort', choices=['count', 'name'], default='name',

0 commit comments

Comments
 (0)