Skip to main content
Sumo Logic

Collect Logs for Amazon CloudFront

Before you install the Sumo Logic App for Amazon CloudFront, you'll need to perform the following steps:

  1. Grant Sumo Logic access to an Amazon S3 bucket.
  2. Enable CloudFront logging.
  3. Confirm that logs are being delivered to the Amazon S3 bucket.
  4. Add an AWS Source to Sumo Logic.
  5. Install the Sumo Logic App for Amazon CloudFront.

AWS Source

These configuration instructions apply to log collection from all AWS Source types. Select the correct Source type your specific Source in Step 3. For instructions on collecting CloudWatch metrics from Amazon, see Amazon CloudWatch Source for Metrics.

  1. In Sumo Logic select Manage Data > Collection > Collection
  2. On the Collectors page, click Add Source next to a Hosted Collector.
  3. Select your AWS Source type. 
  4. Enter a name to display for the new Source. Description is optional.
  5. For Bucket Name, enter the exact name of your organization's S3 bucket. 
    Be sure to double-check the name as it appears in AWS, for example:

  1. For Path Expression, enter the string that matches the S3 objects you'd like to collect. A wildcard (*) can be used in this string. (Do NOT use a leading forward slash. See About Amazon Path Expressions for details). Remember that recursive path expressions use a single wild card.
  2. Collection should begin. Choose or enter how far back you'd like to begin collecting historical logs. You can either:
    • Choose a predefined value from dropdown list, ranging from "Now" to “72 hours ago” to “All Time”, or
    • Enter a relative value. To enter a relative value, click the Collection should begin field and press the delete key on your keyboard to clear the field. Then, enter a relative time expression, for example-1w. You can define when you want collection to begin in terms of months (M), weeks (w), days (d), hours (h) and minutes (m).
  1. For Source Category, enter any string to tag the output collected from this Source. (Category metadata is stored in a searchable field called _sourceCategory.)
  2. For Key ID, enter the AWS Access Key ID number granted to Sumo Logic. (See Granting access to an S3 bucket for more information.)
  3. For Secret Key, enter the AWS Secret Access Key Sumo Logic should use to access the S3 bucket. (See Granting access to an S3 bucket for more information.)
  4. For Scan Interval, use the default of 5 minutes. Alternately, enter the frequency Sumo Logic will scan your S3 bucket for new data. To learn more about Scan Interval considerations, see About setting the S3 Scan Interval.
  5. If you need the Advanced options for timestamp and time zone you can set:
    • Enable Timestamp Parsing. This option is selected by default. If it's deselected, no timestamp information is parsed at all.
    • Time Zone. There are two options for Time Zone. You can use the time zone present in your log files, and then choose an option in case time zone information is missing from a log message. Or, you can have Sumo Logic completely disregard any time zone information present in logs by forcing a time zone. It's very important to have the proper time zone set, no matter which option you choose. If the time zone of logs can't be determined, Sumo Logic assigns logs UTC; if the rest of your logs are from another time zone your search results will be affected.
    • Timestamp Format. By default, Sumo Logic will automatically detect the timestamp format of your logs. However, you can manually specify a timestamp format for a Source. See Timestamps, Time Zones, Time Ranges, and Date Formats for more information.
  6. Enable Multiline Processing. Multiline processing is enabled by default. Use this option when you're working with multiline messages. 
    • Infer Boundaries. Infer boundaries is enabled by default. Use this option when you want Sumo Logic to automatically attempt to determine which lines belong to the same message. This may not be accurate for all log types. If you deselect the Infer Boundaries option, you will need to enter a regular expression in the Boundary Regex field to use for detecting the entire first line of multi-line messages.
    • Boundary Regex. You can specify the boundary between messages using a regular expression, when the infer boundaries option does not work. Enter a regular expression for the full first line of every multiline message in your log files.
      For example, if your CloudFront log message is of this format -
      2017-06-13    22:02:13    SYD1 ..............
       You could use this Boundary Regex -
      For more details, see Define Boundary Regex.
  7. Create any Processing Rules you'd like for the AWS Source.
  8. When you are finished configuring the Source click Save.

Sample Log Message

2017-09-27 00:21:12 ORD51-M1 335 GET /content/FDW/HLS/HLS360p/FDW_s01e002_tv_hv_or_en_xx_HLS360p_16x9_00_v00154.ts 403 Mozilla/5.0%2520(Macintosh;%2520Intel%2520Mac%2520OS%2520X%252010.12;%2520rv:54.0)%2520Gecko/20100101%2520Firefox/54.0 Policy=eyJTdGF0ZW1lbnQiOiBbeyJSZXNvdXJjZSI6Imh0dHBzOi8vZDM5dG5yZzRlbnBrNncuY2xvdWRmcm9udC5uZXQvY29udGVudC9GRFcvSExTL0hMUzM2MHAvRkRXX3MwMWUwMDJfdHZfaHZfb3JfZW5feHhfSExTMzYwcF8xNng5XzAwX3YwMDE1NC50cyIsIkNvbmRpdGlvbiI6eyJEYXRlTGVzc1RoYW4iOnsiQVdTOkVwb2NoVGltZSI6MTUwMzk4MTc1OX0sIklwQWRkcmVzcyI6eyJBV1M6U291cmNlSXAiOiI2NS4zMC4xLjEzOC8zMiJ9LCJEYXRlR3JlYXRlclRoYW4iOnsiQVdTOkVwb2NoVGltZSI6MTUwMzk3NDI1OX19fV19&Signature=NCDlKRp6Nv9triqA1r-RBulrMXlvQCRxH16c3dP4RGdmwx8yQO0d75%7EdN94-wwaQ2x7NDlzNUrn7IXkUyHJN3S9kdx7RfVt-gQw9E3hMc4rYYe5NVR0wAeye%7E3gMKuFY%7EhshJqMrbE96HmzzhgQ5qS9gW797PDiwddCmtjYxqgndfF7jO2JJ9QwSpHfqcn5Ceo89Ra0mxwjo4JYu8JfiDhbOAkTU7mpy1ql%7EmYOuwc4zntjMK%7ERKOtcrV3sP9uIunpdh6Ur0-pOmPYTJt13VgUfoYmFB0CJnc8TMosN8ouqMIlSnLXfeKiIdDiP%7EGQKtYeZ54NVx6PqrmOQBSVhikg__&Key-Pair-Id=APKAIWFUV66JZQCBHYXA - Error h5BKcPRKo5oIEz0KZ06V6bRCTJttiW_WUJQmT71jjTnYGE8pA1kfQA== https 722 0.001 - TLSv1.2 ECDHE-RSA-AES128-GCM-SHA256 Error HTTP/2.0

Query Sample

Count of HTTP Status Codes

_sourceCategory= aws/cf | parse "*\t*\t*\t*\t*\t*\t*\t*\t*\t*\t*\t*\t*\t*\t*" as _filedate,_ftime,edgeloc, scbytes, c_ip,method,cs_host,uri_stem,status,referer,user_agent,uri_query,cookie,edgeresult,requestid 
| count as count by status
| sort by count