2024-01-25 21:42:21 +01:00
|
|
|
# Akamai Datastream2 logs all accesses into AWS S3:
|
|
|
|
# https://techdocs.akamai.com/datastream2/docs/stream-amazon-s3
|
|
|
|
#
|
|
|
|
# The S3 bucket is configured to send event notifications to the SQS
|
|
|
|
# queue, which this host is allowed to read from. This consumer
|
|
|
|
# deletes the messages from the queue, and the S3 bucket is
|
|
|
|
# configured to purge old logs.
|
|
|
|
# https://vector.dev/docs/reference/configuration/sources/aws_s3/
|
|
|
|
|
|
|
|
<% @pipelines.each do |key,sqs_url| %>
|
|
|
|
[sources.s3_akamai_<%= key %>]
|
2023-11-13 18:20:27 +01:00
|
|
|
type = "aws_s3"
|
|
|
|
region = "us-east-1"
|
|
|
|
compression = "gzip"
|
|
|
|
sqs.delete_message = true
|
|
|
|
sqs.poll_secs = 15
|
2024-01-25 21:42:21 +01:00
|
|
|
sqs.queue_url = "<%= sqs_url %>"
|
2023-11-13 18:20:27 +01:00
|
|
|
|
2024-09-25 19:08:25 +02:00
|
|
|
[transforms.akamai_parse_<%= key %>]
|
2023-11-13 18:20:27 +01:00
|
|
|
type = "remap"
|
2024-01-25 21:42:21 +01:00
|
|
|
inputs = ["s3_akamai_<%= key %>"]
|
2023-11-13 18:20:27 +01:00
|
|
|
source = '''
|
|
|
|
. = parse_json!(string!(.message))
|
|
|
|
.turnAroundTimeSec = to_int!(.turnAroundTimeMSec) / 1000.0
|
|
|
|
'''
|
|
|
|
|
2024-09-25 19:08:25 +02:00
|
|
|
[transforms.akamai_logs2metrics_<%= key %>]
|
2023-11-13 18:20:27 +01:00
|
|
|
type = "log_to_metric"
|
2024-09-25 19:08:25 +02:00
|
|
|
inputs = ["akamai_parse_<%= key %>"]
|
2023-11-13 18:20:27 +01:00
|
|
|
|
2024-09-25 19:08:25 +02:00
|
|
|
[[transforms.akamai_logs2metrics_<%= key %>.metrics]]
|
2023-11-13 18:20:27 +01:00
|
|
|
field = "cacheStatus"
|
|
|
|
name = "requests_cache_count"
|
2024-01-25 21:42:21 +01:00
|
|
|
namespace = "akamai_<%= key %>"
|
2023-11-13 18:20:27 +01:00
|
|
|
type = "counter"
|
2024-09-25 19:08:25 +02:00
|
|
|
[transforms.akamai_logs2metrics_<%= key %>.metrics.tags]
|
2023-11-13 18:20:27 +01:00
|
|
|
status_code = "{{statusCode}}"
|
|
|
|
cached = "{{cacheStatus}}"
|
|
|
|
host = "{{reqHost}}"
|
|
|
|
|
2024-09-25 19:08:25 +02:00
|
|
|
[[transforms.akamai_logs2metrics_<%= key %>.metrics]]
|
2023-11-13 18:20:27 +01:00
|
|
|
field = "bytes"
|
|
|
|
name = "requests_bytes"
|
2024-01-25 21:42:21 +01:00
|
|
|
namespace = "akamai_<%= key %>"
|
2023-11-13 18:20:27 +01:00
|
|
|
type = "counter"
|
|
|
|
increment_by_value = true
|
2024-09-25 19:08:25 +02:00
|
|
|
[transforms.akamai_logs2metrics_<%= key %>.metrics.tags]
|
2023-11-13 18:20:27 +01:00
|
|
|
status_code = "{{statusCode}}"
|
|
|
|
cached = "{{cacheStatus}}"
|
|
|
|
host = "{{reqHost}}"
|
|
|
|
|
2024-09-25 19:08:25 +02:00
|
|
|
[[transforms.akamai_logs2metrics_<%= key %>.metrics]]
|
2023-11-13 18:20:27 +01:00
|
|
|
field = "turnAroundTimeSec"
|
|
|
|
name = "turnaround_time_sec"
|
2024-01-25 21:42:21 +01:00
|
|
|
namespace = "akamai_<%= key %>"
|
2023-11-13 18:20:27 +01:00
|
|
|
type = "histogram"
|
2024-09-25 19:08:25 +02:00
|
|
|
[transforms.akamai_logs2metrics_<%= key %>.metrics.tags]
|
2023-11-13 18:20:27 +01:00
|
|
|
status_code = "{{statusCode}}"
|
|
|
|
cached = "{{cacheStatus}}"
|
|
|
|
host = "{{reqHost}}"
|
|
|
|
|
2024-01-25 21:42:21 +01:00
|
|
|
<% end %>
|