Observed since 20 Oct, 17:59 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
Analysis AWS WAF logs and generate a report

Accompanist is an AWS WAF log analysis tool and an "accompanist" of WAF operation.
It enables you to analyze AWS WAF logs and automatically generate instant analysis reports in just three simple steps.
If you're operating AWS WAF, this tool can be helpful for instant log analysis and help you understand the trends of blocked or counted accesses.
Requirement
IAM Role/User policy
$ pip install accompanist
config.json file.$ accompanist init
config.json file directly.BLOCK log for the past three days$ accompanist listen -a BLOCK -d 3
$ accompanist play
$ pip uninstall accompanist
--json_log or -j option can be help to investigate the detail of WAF logs.
--color or -d .accompanist init # interactive inputting process
-l, --log-group TEXT Set a CloudWatch Logs Log group name. [required]
-p, --path TEXT Set a URI path for counts that is blocked/counted.[required]
-c, --comment TEXT Set a comment for report. [required]
-h, --help Show this message and exit.
accompanist listen [OPTIONS]
-a, --action [BLOCK|COUNT] Chose an action type of AWS WAF. The default is
"BLOCK". [required]
-d, --days INTEGER Set a number of the past days until today for
analysis target period.
-s, --start_time INTEGER Set a UNIX time of the oldest time for analysis
target period (instead of "--days").
-e, --end_time INTEGER Set a UNIX time of the latest time for analysis
target period (instead of "--days").
-j, --json-log Output a JSON log file. Please handle it with care.
for debugging.
-h, --help Show this message and exit.
Note: This is experimental feature.
accompanist hear [OPTIONS]
-a, --action [BLOCK|COUNT] Chose an action type of AWS WAF. The default is
"BLOCK". [required]
-d, --days INTEGER Set a number of the past days until today for
analysis target period.
-s, --start_time INTEGER Set a UNIX time of the oldest time for analysis
target period (instead of "--days").
-e, --end_time INTEGER Set a UNIX time of the latest time for analysis
target period (instead of "--days").
-h, --help Show this message and exit.
accompanist play [OPTIONS]
-c, --colorful Set a random color of report theme (instead
of color).
-d, --color TEXT Customize a color of report theme with color
code, (e.g.) #cccccc.
-m, --mask-ip Mask IP addresses on pie chart.
-u, --utc-offset INTEGER Set a number of UTC offest. The defaut
offset is UTC+9 (Asia/Tokyo).
-y, --y-limit [10|20|30|50|100|500|1000]
Adjust a Y-axis max limitation for
histograms due to many requests.
-er, --exclude-rule-group TEXT Exclude a rule group from analysis target.
This option can be added multiple.
-h, --help Show this message and exit.
Here is an example of IAM policy with restricted permissions.
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "logs:StartQuery",
"Resource": [
"arn:aws:logs:<region>:<aws-acount>:log-group:<log-group-name>:*"
]
},
{
"Effect": "Allow",
"Action": "logs:GetQueryResults",
"Resource": "*"
}
]
}
Note: The <region>, <aws-acount> and <log-group-name> in this sample policy should be replaced.
Here is an example of IAM policy with restricted permissions.
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "s3:ListBucket",
"Resource": "arn:aws:s3:::<waf-log-bucket>"
},
{
"Effect": "Allow",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::<waf-log-bucket>/*"
}
]
}
Note: The <waf-log-bucket>in this sample policy should be replaced.
Copyright 2023 Itsuki Yutaka
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Download counts and popularity will appear here as the collector receives them.
| Version | Published | Direct dependencies | Open version |
|---|---|---|---|
| 1.3.3 | 30 Mar 2024 | 6 |
This describes our collected data; it is not a security assessment.
Observed since 20 Oct, 17:59 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:d3dfb16e542a659e98c736dde59e683c1d6ed0002caf86703870c30fa2c6935c