File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed
transition/terraform/dev/scripts Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -43,7 +43,13 @@ sudo tee /etc/td-agent-bit/td-agent-bit.conf > /dev/null <<EOF
4343[FILTER]
4444 Name grep
4545 Match startup.log
46- Regex message startup-script
46+ Regex log .*startup%-script.*
47+
48+ [FILTER]
49+ Name lua
50+ Match startup.log
51+ script /etc/td-agent-bit/trim_log.lua
52+ call trim
4753
4854[OUTPUT]
4955 Name cloudwatch_logs
@@ -70,6 +76,17 @@ sudo tee /etc/td-agent-bit/td-agent-bit.conf > /dev/null <<EOF
7076 auto_create_group true
7177EOF
7278
79+ sudo tee /etc/td-agent-bit/trim_log.lua > /dev/null << 'EOF '
80+ function trim(tag, timestamp, record)
81+ local raw = record["log"]
82+ local trimmed = string.match(raw, "startup%-script: (.*)")
83+ if trimmed then
84+ record["log"] = trimmed
85+ end
86+ return 1, timestamp, record
87+ end
88+ EOF
89+
7390sudo mkdir -p /etc/systemd/system/td-agent-bit.service.d
7491sudo tee /etc/systemd/system/td-agent-bit.service.d/aws-creds.conf > /dev/null << EOF
7592[Service]
You can’t perform that action at this time.
0 commit comments