Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
371945d
Add initial mod
Priyanka-Chatterjee-2000 Apr 2, 2025
21abe30
Update Apache Activity Dashboard: Revise chart titles and queries for…
Priyanka-Chatterjee-2000 Apr 3, 2025
60c41ba
Refactor Apache Detection Modules: Remove deprecated detections, upda…
Priyanka-Chatterjee-2000 Apr 3, 2025
86822b9
Add back the detections using agregated queries
Priyanka-Chatterjee-2000 Apr 3, 2025
38806d2
Remove Apache Activity Dashboard and associated documentation; update…
Priyanka-Chatterjee-2000 Apr 4, 2025
457c890
Add local detection_display_columns
Priyanka-Chatterjee-2000 Apr 4, 2025
efa0212
Refactor naming conventions for benchmarks and detections
Priyanka-Chatterjee-2000 Apr 4, 2025
2ebb846
Rename files
Priyanka-Chatterjee-2000 Apr 4, 2025
1c3abc0
Refactor detection
Priyanka-Chatterjee-2000 Apr 4, 2025
4afdf92
Update access log detections and security tags
Priyanka-Chatterjee-2000 Apr 4, 2025
8325de8
Refactor activity dashboard and local detection columns
Priyanka-Chatterjee-2000 Apr 4, 2025
afa1dd5
Add documentation for detections
Priyanka-Chatterjee-2000 Apr 4, 2025
ad73675
Remove unwanted links
Priyanka-Chatterjee-2000 Apr 4, 2025
93a8165
Remove extra content from the doc overview
Priyanka-Chatterjee-2000 Apr 4, 2025
c94e514
Remove unintended links
Priyanka-Chatterjee-2000 Apr 4, 2025
136164a
Add new security detections
Priyanka-Chatterjee-2000 Apr 7, 2025
c1335e4
rename the OWASP sub-benchamark files
Priyanka-Chatterjee-2000 Apr 7, 2025
343cef1
Rename query for daily requests in activity dashboard and update corr…
Priyanka-Chatterjee-2000 Apr 7, 2025
d3ce0e3
Add CWE-22 benchmark for path traversal detection
Priyanka-Chatterjee-2000 Apr 7, 2025
b12ba85
Add CWE benchmarks
Priyanka-Chatterjee-2000 Apr 7, 2025
faf808d
Minor dashboard changes
cbruno10 Apr 7, 2025
eff66c0
Update activity dashboard cards, charts, and queries
cbruno10 Apr 8, 2025
ed3eb7a
Revert "Add CWE benchmarks"
Priyanka-Chatterjee-2000 Apr 8, 2025
bb3a0b1
Remove non security detections
Priyanka-Chatterjee-2000 Apr 8, 2025
92f0d44
Add images
Priyanka-Chatterjee-2000 Apr 8, 2025
be18ccf
Add more detections to owasp_top10
Priyanka-Chatterjee-2000 Apr 8, 2025
840c3c1
Add mitre basic structure
Priyanka-Chatterjee-2000 Apr 8, 2025
24212c3
Update OWASP top 10
Priyanka-Chatterjee-2000 Apr 9, 2025
b8aa622
Minor query fix
Priyanka-Chatterjee-2000 Apr 9, 2025
9d34781
Add SQL injection detections
cbruno10 Apr 9, 2025
fdc170c
Update detection display columns and add local file inclusion detections
cbruno10 Apr 9, 2025
2e51687
Add XSS detections
cbruno10 Apr 9, 2025
11bde5a
Fix exclude condition
cbruno10 Apr 9, 2025
9a929fa
Rename various benchmarks and detections to be more consistent
cbruno10 Apr 10, 2025
dd12da6
Remove unused detections and docs
cbruno10 Apr 10, 2025
56960ad
Add new RCE benchmark and detections
cbruno10 Apr 10, 2025
e570d83
Rename various detections, remove unused docs, fix some queries
cbruno10 Apr 10, 2025
27ae78f
Update owasp benchmark naming convention
Priyanka-Chatterjee-2000 Apr 10, 2025
51429cc
Update detection tags for techniques in the MITRE framework and add t…
Priyanka-Chatterjee-2000 Apr 10, 2025
660bccb
Fix broken syntax and sort benchmark children
cbruno10 Apr 10, 2025
e930217
Minor fix
Priyanka-Chatterjee-2000 Apr 10, 2025
5e13f28
Temporarily switch Requests by Day to line
cbruno10 Apr 10, 2025
1ba42cf
Update cross-site scripting related detections
Priyanka-Chatterjee-2000 Apr 11, 2025
53005da
update sql injection queries to reduce false positives and false nege…
Priyanka-Chatterjee-2000 Apr 13, 2025
8d27846
Add owasp docs
Priyanka-Chatterjee-2000 Apr 13, 2025
32db09b
Update cross_site_scripting_detections
Priyanka-Chatterjee-2000 Apr 14, 2025
5db3215
Update apache owasp top 10
Priyanka-Chatterjee-2000 Apr 14, 2025
b4459c9
Update activity dashboard image
Priyanka-Chatterjee-2000 Apr 14, 2025
e3a4469
Update docs
Priyanka-Chatterjee-2000 Apr 15, 2025
0a45180
Update mod.pp
Priyanka-Chatterjee-2000 Apr 15, 2025
9c96099
Add UTF-7 encoding detection to cross-site scripting queries
Priyanka-Chatterjee-2000 Apr 15, 2025
73bd116
Revert sql_injestion changes
Priyanka-Chatterjee-2000 Apr 15, 2025
60e1374
Add more sorting to dashboard queries
cbruno10 Apr 16, 2025
45fb232
Update OWASP Top 10 2021 benchmark file names and docs
cbruno10 Apr 16, 2025
35f6877
Improve sql_injection_common_patterns query detection for multi-line …
cbruno10 Apr 16, 2025
58c6ba8
Update images
cbruno10 Apr 16, 2025
c2862d1
Fix broken links
cbruno10 Apr 16, 2025
c646f90
Remove redundant SQL injection checks
cbruno10 Apr 16, 2025
51c673d
Update sql_injection_blind_based query to reduce false positives
cbruno10 Apr 16, 2025
ff4288c
Update user agent chart
cbruno10 Apr 16, 2025
2a57d0b
Remove unused detection doc
cbruno10 Apr 16, 2025
e2548a3
Sort detections in OWASP A03 benchmark
cbruno10 Apr 16, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
# Apache Access Log Detections Mod for Powerpipe

View dashboards, run detections and scan for anomalies across your Apache access logs.
[Tailpipe](https://tailpipe.io) is an open-source CLI tool that allows you to collect logs and query them with SQL.

<!--
TODO: Insert images
-->
The [Apache Access Log Detections Mod](https://hub.powerpipe.io/mods/turbot/tailpipe-mod-apache-access-log-detections) contains pre-built dashboards and detections, which can be used to monitor and analyze activity across your Apache servers.

Run detection benchmarks:
![image](docs/images/apache_access_log_owasp_dashboard.png)

View insights in dashboards:
![image](docs/images/apache_access_log_activity_dashboard.png)

## Documentation

Expand Down Expand Up @@ -102,13 +106,12 @@ List available benchmarks:
powerpipe benchmark list
```

<!-- TODO: add a benchmark name and uncomment
Run a benchmark:

```sh
powerpipe benchmark run apache_access_log_detections.benchmark.
powerpipe benchmark run apache_access_log_detections.benchmark.owasp_top_10
```
-->

Different output formats are also available, for more information please see
[Output Formats](https://powerpipe.io/docs/reference/cli/benchmark#output-formats).

Expand All @@ -126,4 +129,4 @@ Want to help but don't know where to start? Pick up one of the `help wanted` iss

- [Powerpipe](https://github.com/turbot/powerpipe/labels/help%20wanted)
- [Tailpipe](https://github.com/turbot/tailpipe/labels/help%20wanted)
- [Apache Access Log Detections Mod](https://github.com/turbot/tailpipe-mod-apache-access-log-detections/labels/help%20wanted)
- [Apache Access Log Detections Mod](https://github.com/turbot/tailpipe-mod-apache-access-log-detections/labels/help%20wanted)
339 changes: 339 additions & 0 deletions dashboards/activity_dashboard.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,339 @@
dashboard "activity_dashboard" {
title = "Access Log Activity Dashboard"
documentation = file("./dashboards/docs/activity_dashboard.md")

tags = {
type = "Dashboard"
service = "Apache/AccessLog"
}

container {
# Analysis
card {
query = query.activity_dashboard_total_logs
width = 2
}

card {
query = query.activity_dashboard_success_count
width = 2
type = "ok"
}

card {
query = query.activity_dashboard_redirect_count
width = 2
type = "info"
}

card {
query = query.activity_dashboard_bad_request_count
width = 2
type = "alert"
}

card {
query = query.activity_dashboard_error_count
width = 2
type = "alert"
}
}

container {

chart {
title = "Requests by Day"
query = query.activity_dashboard_requests_by_day
width = 6
type = "line"
}

chart {
title = "Requests by HTTP Method"
query = query.activity_dashboard_requests_by_http_method
width = 6
type = "bar"
}

chart {
title = "Requests by Status Code"
query = query.activity_dashboard_requests_by_status_code
width = 6
type = "pie"
}

chart {
title = "Top 10 User Agents (Requests)"
query = query.activity_dashboard_requests_by_user_agent
width = 6
type = "pie"
}

chart {
title = "Top 10 Clients (Requests)"
query = query.activity_dashboard_top_10_clients
width = 6
type = "table"
}

chart {
title = "Top 10 URLs (Requests)"
query = query.activity_dashboard_top_10_urls
width = 6
type = "table"
}

chart {
title = "Top 10 URLs (Successful Requests)"
query = query.activity_dashboard_requests_by_successful_requests
width = 6
type = "table"
}

chart {
title = "Top 10 URLs (Errors)"
query = query.activity_dashboard_requests_by_errors
width = 6
type = "table"
}
}

}

# Queries
query "activity_dashboard_total_logs" {
title = "Log Count"
description = "Count the total Apache log entries."

sql = <<-EOQ
select
count(*) as "Total Requests"
from
apache_access_log;
EOQ
}

query "activity_dashboard_success_count" {
title = "Successful Request Count"
description = "Count of successful HTTP requests (status 2xx)."

sql = <<-EOQ
select
count(*) as "Successful (2xx)"
from
apache_access_log
where
status between 200 and 299;
EOQ
}

query "activity_dashboard_redirect_count" {
title = "Redirect Request Count"
description = "Count of redirect HTTP requests (status 3xx)."

sql = <<-EOQ
select
count(*) as "Redirections (3xx)"
from
apache_access_log
where
status between 300 and 399;
EOQ
}

query "activity_dashboard_bad_request_count" {
title = "Bad Request Count"
description = "Count of client error HTTP requests (status 4xx)."

sql = <<-EOQ
select
count(*) as "Bad Requests (4xx)"
from
apache_access_log
where
status between 400 and 499;
EOQ
}

query "activity_dashboard_error_count" {
title = "Server Error Count"
description = "Count of server error HTTP requests (status 5xx)."

sql = <<-EOQ
select
count(*) as "Server Errors (5xx)"
from
apache_access_log
where
status between 500 and 599;
EOQ
}

query "activity_dashboard_top_10_clients" {
title = "Top 10 Clients (Requests)"
description = "List the top 10 client IPs by request count."

sql = <<-EOQ
select
remote_addr as "Client IP",
count(*) as "Request Count"
from
apache_access_log
group by
remote_addr
order by
count(*) desc,
remote_addr
limit 10;
EOQ
}

query "activity_dashboard_top_10_urls" {
title = "Top 10 URLs (Requests)"
description = "List the top 10 requested URLs by request count."

sql = <<-EOQ
select
request_uri as "URL",
count(*) as "Request Count"
from
apache_access_log
where
request_uri is not null
group by
request_uri
order by
count(*) desc,
request_uri
limit 10;
EOQ
}

query "activity_dashboard_requests_by_day" {
title = "Requests by Day"
description = "Count of requests grouped by day."

sql = <<-EOQ
select
strftime(tp_timestamp, '%Y-%m-%d') as "Date",
count(*) as "Request Count"
from
apache_access_log
group by
strftime(tp_timestamp, '%Y-%m-%d')
order by
strftime(tp_timestamp, '%Y-%m-%d');
EOQ
}

query "activity_dashboard_requests_by_status_code" {
title = "Requests by Status Code"
description = "Count of rqeuests grouped by status code."

sql = <<-EOQ
select
case
when status between 200 and 299 then '2xx Success'
when status between 300 and 399 then '3xx Redirect'
when status between 400 and 499 then '4xx Client Error'
when status between 500 and 599 then '5xx Server Error'
else 'Other'
end as "Status Category",
count(*) as "Request Count"
from
apache_access_log
where
status is not null
group by
"Status Category"
order by
"Status Category";
EOQ
}

query "activity_dashboard_requests_by_http_method" {
title = "Requests by HTTP Method"
description = "Distribution of HTTP methods used in requests."

sql = <<-EOQ
select
request_method as "HTTP Method",
count(*) as "Request Count"
from
apache_access_log
where
request_method is not null
group by
request_method
order by
count(*) asc,
request_method;
EOQ
}

query "activity_dashboard_requests_by_successful_requests" {
title = "Top 10 URLs (Successful Requests)"
description = "List the top 10 requested URLs by successful request count."

sql = <<-EOQ
select
request_uri as "Path",
count(*) as "Request Count",
string_agg(distinct status::text, ', ' order by status::text) as "Status Codes"
from
apache_access_log
where
status between 200 and 299
and request_uri is not null
group by
request_uri
order by
count(*) desc,
request_uri
limit 10;
EOQ
}

query "activity_dashboard_requests_by_errors" {
title = "Top 10 URLs (Errors)"
description = "List the top 10 requested URLs by error count."

sql = <<-EOQ
select
request_uri as "Path",
count(*) as "Error Count",
string_agg(distinct status::text, ', ' order by status::text) as "Status Codes"
from
apache_access_log
where
status between 400 and 599
and request_uri is not null
group by
request_uri
order by
count(*) desc,
request_uri
limit 10;
EOQ
}

query "activity_dashboard_requests_by_user_agent" {
title = "Top 10 User Agents (Requests)"
description = "Distribution of user agents in requests."

sql = <<-EOQ
select
http_user_agent as "User Agent",
count(*) as "Request Count"
from
apache_access_log
where
http_user_agent is not null
group by
http_user_agent
order by
count(*) desc,
http_user_agent
limit 10;
EOQ
}
11 changes: 11 additions & 0 deletions dashboards/docs/activity_dashboard.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
This dashboard answers the following questions:

- How many HTTP requests has the Apache server handled?
- What is the distribution of HTTP status codes (success, redirect, client errors, server errors)?
- What HTTP methods are being used most frequently?
- How has request volume changed over time?
- Which browsers and tools are accessing the server?
- Which client IPs are generating the most traffic?
- Which URIs are most frequently requested?
- Which paths have the most successful requests?
- Which paths are generating the most errors?
Loading