I set up a very basic metric filter for a log-stream to count the number of lines matching a certain condition. My usecase is very similiar to the one described at the tutorial for counting apache HTTP status codes.
E.g. the log-events look like
127.0.0.1 - frank [10/Oct/2000:13:55:36 -0700] "GET /apache_pb.gif HTTP/1.0" 404 2326
and the filter is very similiar to
[IP, UserInfo, User, Timestamp, RequestInfo, StatusCode=404, Bytes]
I set up the metric-filter via the Cloudwatch console. The filter works perfectly except that it accumulates the values for all instanceids. However the metric is only valuable to me if it it takes the instanceid into account.
Is there a way to get the metric per instanceid, e.g. to write the instanceid as dimension to the metric?
I searched for a while but could not find anything appropriate. It is very important to me, that i don't have to hardcode the instanceid since instances might get terminated at any point and new instances will be created. Further on I want to avoid evaluating the metric on the EC2-machine.
Is there any way to achieve my goal? I would really appreciate any suggestions!