amazon-cloudwatch-agent
amazon-cloudwatch-agent copied to clipboard
multi_line_start_pattern value should be validated on launch
Describe the bug
When a user uses a malformed regexp as multi_line_start_pattern value, the command exists successfully but logs are not submitted to CloudWatch Logs.
Steps to reproduce
- create a configuration file, with
multi_line_start_patternsetting for a log, but themulti_line_start_patternvalue is not a correct regexp. - execute
/opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -s -c file:/opt/aws/amazon-cloudwatch-agent/bin/config.jsonas a root user
What did you expect to see?
- the command
amazon-cloudwatch-agent-ctlexits with non-zero status code - the command
amazon-cloudwatch-agent-ctlDOES NOT sayConfiguration validation succeeded
What did you see instead?
- the command
amazon-cloudwatch-agent-ctlexits with 0 status code - the command
amazon-cloudwatch-agent-ctlDOES sayConfiguration validation succeeded - the log file
/opt/aws/amazon-cloudwatch-agent/logs/amazon-cloudwatch-agent.logis filled with a log messageW! [inputs.logfile] not started with file state folder %s/opt/aws/amazon-cloudwatch-agent/logs/state. This log entry comes every seconds.
What version did you use? Version: 1.300031.0b313
What config did you use?
logs section
"logs": {
"logs_collected": {
"files": {
"collect_list": [
{
"file_path": "/var/log/foo.log",
"log_group_name": "foolog",
"log_stream_name": "{instance_id}",
"multi_line_start_pattern": "*",
"retention_in_days": -1
}
]
}
}
},
Environment OS: Ubuntu 22.04 on EC2
Additional context
- if the
multi_line_start_patternvalue is an empty string, the validation process fails as expected. - current documentation does not provide any example for
multi_line_start_patternregexp. I guess some examples in this document might also be effective to prevent users from wasting long time.
This issue was marked stale due to lack of activity.
Closing this because it has stalled. Feel free to reopen if this issue is still relevant, or to ping the collaborator who labeled it stalled if you have any questions.