Skip to content

Instantly share code, notes, and snippets.

@mdfranz
Created August 28, 2022 22:14
Show Gist options
  • Save mdfranz/3e1e0ffbfa8123ff2d888b9b4a9df17e to your computer and use it in GitHub Desktop.
Save mdfranz/3e1e0ffbfa8123ff2d888b9b4a9df17e to your computer and use it in GitHub Desktop.
k3s and iptables logs to CloudWatch with Vector
# See the Vector Remap Language reference for more info: https://vrl.dev
[sources.k3s]
type = "journald"
include_units = ["k3s"]
[sources.kernel]
type = "file"
include = ["/var/log/messages"]
[transforms.iptables_parse]
inputs = ["kernel"]
type = "remap"
source = """
.iptables = parse_syslog!(.message)
.packet = parse_key_value!(.iptables.message)
"""
[sinks.cloudwatch]
type = "aws_cloudwatch_logs"
inputs = [ "k3s","iptables_parse" ]
create_missing_group = false
create_missing_stream = true
group_name = "k3s-honeynet"
compression = "none"
region = "us-east-2"
stream_name = "{{host}}"
[sinks.cloudwatch.encoding]
codec = "json"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment