Skip to content

Commit 7a967fb

Browse files
committedMar 11, 2024·
docs: update readme
1 parent 1f904b6 commit 7a967fb

File tree

1 file changed

+44
-27
lines changed

1 file changed

+44
-27
lines changed
 

‎README.md

+44-27
Original file line numberDiff line numberDiff line change
@@ -55,65 +55,82 @@ GLOBAL OPTIONS:
5555

5656
```text
5757
NAME:
58-
alpen clf - Parses apache common/combined log format
58+
alpen s3 - Parses S3 access logs
5959
6060
USAGE:
61-
alpen clf
61+
alpen s3
6262
6363
DESCRIPTION:
64-
Parses apache common/combined log format and converts them to structured formats
64+
Parses S3 access logs and converts them to structured formats
6565
6666
OPTIONS:
67-
--input value, -i value input from string
68-
--file-path value, -f value input from file path
69-
--gzip-path value, -g value input from gzip file path
70-
--zip-path value, -z value input from zip file path
71-
--output value, -o value select output format: json|pretty-json|text|ltsv|tsv (default: "json")
72-
--skip value, -s value [ --skip value, -s value ] skip records by index
73-
--metadata, -m enable metadata output (default: false)
74-
--line-number, -l set line number at the beginning of the line (default: false)
75-
--header, -H set header: avairable for tsv output (default: false)
76-
--glob-pattern value, -G value filter glob pattern: available for parsing zip only (default: "*")
77-
--help, -h show help
67+
--input value, -i value select input type: default|gz|zip (default: "default")
68+
--output value, -o value select output type: json|pretty-json|text|ltsv|tsv (default: "json")
69+
--result, -r enable result output (default: false)
70+
--glob value, -g value filter glob pattern: available for parsing zip only (default: "*")
71+
--labels value, -l value [ --labels value, -l value ] select labels to output with labels
72+
--filters value, -f value [ --filters value, -f value ] set filter expressions: allowed operator: >|>=|<|<=|==|!=|==*|!=*|=~|!~|=~*|!~*
73+
--skip value, -s value [ --skip value, -s value ] skip lines by line number
74+
--prefix, -p enable line prefix: PROCESSED|UNMATCHED (default: false)
75+
--unmatch, -u enable output of unmatched lines (default: false)
76+
--num, -n set line number at the beginning of the line (default: false)
77+
--help, -h show help
7878
```
7979

8080
Example
8181
-------
8282

8383
```sh
8484
# Read and convert s3 logs from file and convert to default NDJSON format
85-
alpen s3 -f "sample_s3.log"
85+
alpen s3 "sample_s3.log"
8686

87-
# Set line number at the beginning of line, like "index": "n"
88-
alpen s3 -f "sample_s3.log" -l
87+
# Set line number at the beginning of line
88+
alpen s3 -n "sample_s3.log"
8989

90-
# Read s3 logs from file and convert to pretty NDJSON, also output metadata
91-
alpen s3 -f "sample_s3.log" -o pretty-json -m
90+
# Read s3 log from file, convert to pretty NDJSON and output parsed results
91+
alpen s3 -r -o pretty-json "sample_s3.log"
92+
93+
# Can be combined with tail -f to process standard input
94+
# Results are consistent, even if interrupted with CTRL+C
95+
tail -f sample_s3.log | alpen s3 -r
9296

9397
# Convert LTSV format
94-
alpen s3 -f "sample_s3.log" -o ltsv -m
98+
alpen s3 -r -o ltsv "sample_s3.log"
9599

96-
# Convert TSV format and enable header
97-
alpen s3 -f "sample_s3.log" -o tsv -H
100+
# In TSV format, the header is set from the parsing result of the first line
101+
alpen s3 -r -o tsv "sample_s3.log"
98102

99103
# Read CloudFront logs from gzip file and skip header lines
100-
alpen cf -g "sample_cloudfront.log.gz" -s 1,2
104+
alpen cf -r -s 1,2 -i gz "sample_cloudfront.log.gz"
101105

102106
# Read ALB logs from zip file and convert all entries with `.log` extension
103-
alpen alb -z "sample_alb.log.zip" -G "*.log"
107+
alpen alb -r -g "*.log" -i zip "sample_alb.log.zip"
108+
109+
# Unmatched lines can also be output raw and made explicit by line prefix
110+
alpen s3 -u -p "sample_s3.log"
111+
112+
# Columns can be narrowed by specifying labels
113+
alpen s3 -l bucket,method,request_uri,protocol "sample_s3.log"
114+
115+
# Filter expressions to narrow down rows
116+
# > >= == <= < (arithmetic (float64))
117+
# == ==* != !=* (string comparison (string))
118+
# =~ !~ =~* !~* (regular expression (string))
119+
# inspired from <https://github.com/sonots/lltsv>
120+
alpen s3 -f "method == GET,operation =~ .*BUCKETPOLICY"
104121

105122
# Read apache common/combined format logs
106123
# Matches both common/combined by default
107124
# Use space or tab as delimiter
108-
alpen clf -f "sample_clf.log"
125+
alpen clf "sample_clf.log"
109126

110127
# Read apache common/combined log format with virtual host
111128
# Matches if virtual host is at the beginning
112-
alpen clfv -f "sample_clf.log"
129+
alpen clfv "sample_clf.log"
113130

114131
# LTSV uses labels as names, so it is not possible to decompose a request into
115132
# methods, request_uri, or protocols.
116-
alpen ltsv -f "sample_ltsv.log"
133+
alpen ltsv "sample_ltsv.log"
117134
```
118135

119136
Installation

0 commit comments

Comments
 (0)
Please sign in to comment.