Changing log line formats

      Last updated November 06, 2019

    Fastly's Real-Time Log Streaming feature allows you to change the format that your log messages are delivered in on select logging endpoints. By default, we send log messages out in standard syslog format. The prefix for this format (as defined in RFC 3164) appears as follows:

     <134>2016-07-04T22:37:26Z cache-sjc3128 LogTest[62959]: <your log message>

    The prefix begins with the message priority (always <134>, which means Facility=Local0, Severity=Informational), followed the date and time the log was sent (2016-07-04T22:37:26Z), the cache node it came from (in this case cache-sjc3128), the name of your log (LogTest) and the ID of the process sending it (62959).

    Available log line message formats

    Although the default message prefix works for most logging services and processors, we allow you to choose one of several formats:

    Updating endpoints to use a different format

    A number of logging endpoints can be updated to use a message format other than the default via either the web interface or the API.

    Using the web interface

    Follow these instructions to update a logging endpoint using the web interface:

    1. Log in to the Fastly web interface and click the Configure link.
    2. From the service menu, select the appropriate service.
    3. Click the Edit configuration button and then select Clone active. The Domains page appears.
    4. Click the Logging link. The Logging endpoints page appears.
    5. Click the name of a logging endpoint you want to edit. The Edit this endpoint page appears.
    6. Click the Advanced options link near the bottom of the page. The Advanced options appear.

      the logging endpoints page

    7. In the Select a log line format section, select a log line format for the logging endpoint.
    8. Click the Update button.
    9. Click the Activate button to deploy your configuration changes.

    Using the API

    Run the following command to update a logging endpoint using the API:

    curl -X PUT -H 'Fastly-Key: FASTLY_API_TOKEN' -H 'Content-Type: application/json' '<your Fastly service ID>/version/<version number>/logging/<logging endpoint>/<log name>' --data-binary '{"message_type":"<type>"}'

    Keep in mind that the message_type field is a per-object field. Updating it on one logging object will not change it on any other objects.

    For example, to update a Google Cloud Storage logging endpoint named "GCS Test" to use the blank message type, the cURL command would look something like this:

    curl -X PUT -H 'Fastly-Key: FASTLY_API_TOKEN' -H 'Content-Type: application/json' '' --data-binary '{"message_type":"blank"}'
    Back to Top