Log streaming: New Relic Logs

      Last updated September 30, 2020

    Fastly's Real-Time Log Streaming feature can send log files to New Relic Logs.


    Before adding New Relic Logs as a logging endpoint for Fastly services, you will need to:

    Adding New Relic Logs as a logging endpoint

    Follow these instructions to add New Relic Logs as a logging endpoint:

    1. Review the information in our Setting Up Remote Log Streaming guide.
    2. Click the New Relic Logs Create endpoint button. The Create a New Relic Logs endpoint page appears.

      the create a New Relic logs page

    3. Fill out the Create a New Relic Logs endpoint fields as follows:

      • In the Name field, enter a human-readable name for the endpoint.
      • In the Log format field, enter the data to send to New Relic Logs. See the example format section for details.
      • In the License key / Insert key field, enter your New Relic license key or Insert API key.
    4. Click the Advanced options link of the Create a New Relic Logs endpoint page. The Advanced options appear.
    5. In the Placement area, select where the logging call should be placed in the generated VCL. Valid values are Format Version Default, None, and waf_debug (waf_debug_log). Selecting None creates a logging object that can only be used in custom VCL. See our guide on WAF logging for more information about waf_debug_log.
    6. Click the Create button to create the new logging endpoint.
    7. Click the Activate button to deploy your configuration changes.

    Example format

    Data sent to New Relic Logs must be serialized as a JSON object. Here's an example format string for sending data to New Relic Logs:

      "is_tls":%{if(req.is_ssl, "true", "false")}V,
      "cache_status":"%{regsub(fastly_info.state, "^(HIT-(SYNTH)|(HITPASS|HIT|MISS|PASS|ERROR|PIPE)).*", "\\2\\3") }V"

    Logging a timestamp

    If a timestamp field is present in the Fastly log, it must be specified as millisecond or seconds since Epoch to override the New Relic timestamp. If not included, Fastly will generate a timestamp.

    Back to Top