'How to write Windows Computer name (of Windows EC2) as a separate field on Cloudwatch Log Group using Cloudwatch agent config?

Windows Logs: 1058,windows-computer-name.prod.domain.com

I see the above line in Cloudwatch Log Group

This is generated by Cloudwatch agent running on a Windows EC2

Question:

Is there a way (to change the Cloudwatch agent config file) to write the Windows computer name to the log group as a separate field on Cloudwatch log group?

(This would help me to query the separate windows computer name field to check if logs from a certain list of computer names are getting forwarded to the log group or not)



Solution 1:[1]

You can push custom metrics to CloudWatch Agent which will be accessible for further processing. You have to use StatsD agent for this purpose. How to push custom metrics to CW is shown below with StatsD example:

https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Agent-custom-metrics-statsd.html

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Hussain Mansoor