Monitoring Configuration

The Fastly Log Shipping module is used to ingest user requests, allowing Netacea to monitor and detect bot activity.

Prerequisites

Before Netacea can monitor your platform successfully, please ensure you have:

  1. Provided Netacea with your Fastly IAM Role, if requested.

  2. Had the relevant log shipping endpoints & credentials shared via the Netacea portal.

  3. Provided a list of all known, safe and trusted list users, partners & 3rd party apps. This includes a list of trusted bots & automated tools. Any information on known bad actors is also valuable.

  4. Provided a list of protection use cases and the pathways that are vulnerable to each.

Minimum Required Dataset

To successfully analyze data, the following data will be monitored:

Required Fields
Description

Timestamp

The time which the request was received

IP Address

The IP address from which the request was made

User Agent

The user agent string sent in the header by the client

Method

The HTTP method of the request

Path

The path of the requested resource

Query

The query string of the request

Status

The HTTP status code returned by the server

Referrer

The web page the user followed a link from

Bytes Sent

The Bytes sent as part of the user's request

Protocol

The protocol of the response-request cycle.

Request Time

How long the request took in microseconds.

Request Host

The current Host request header.

JA3 Fingerprint

JA3 is a method for creating SSL/TLS client fingerprints.

In addition to the above standard fields, the Netacea integration will add several custom fields to the log format. These include:

bc_type, user_id, integration_type and integration_version.

Implementation Steps

  1. Log in to the Fastly web interface.

  2. From the home page, select the appropriate service. You can use the search box to search by ID, name, or domain.

  3. Click the edit configuration button and then select the option to clone the active version. The Domains page appears.

All configuration changes below will be made to the newly cloned version.

Make a note of the currently active version should you need to roll back in the future.

Log Streaming

  • Navigate to the Logging area.

  • Click the "Create endpoint" button for Amazon S3

  • Enter the following details:

Field
Value

Name

Enter a memorable human-readable name for the endpoint, such as Netacea_Logging.

Placement

Format Version Default

Log Format

Timestamp

Bucket Name

The name of the Amazon S3 bucket provided by Netacea portal.

Access Method

The IAM Role ARN or User Credentials provided by Netacea portal.

Period

15

Path

/

Domain

The domain of the Amazon S3 endpoint that has been provided by Netacea.

If not specified, please use s3.eu-west-1.amazonaws.com.

Select a log line format

Blank

Compression

Gzip

Any option not specified above should be left as the default value.

Log Format

{"@timestamp": "%{%Y-%m-%dT%H:%M:%S%z}t","bc_type": %{if(req.http.netacea_bctype_string, "%u0022" + json.escape(req.http.netacea_bctype_string) + "%u0022", "null")}V,"bytes_sent": "%B","cookie_session_status": %{if(req.http.x-netacea:cookie_session_status, "%u0022" + json.escape(req.http.x-netacea:cookie_session_status) + "%u0022", "null")}V,"client": "%{json.escape(client.ip)}V","domain": %{if(req.http.host, "%u0022" + json.escape(req.http.host) + "%u0022", "null")}V,"integration_mode": %{"%u0022" + json.escape(req.http.x-netacea:integration_mode) + "%u0022"}V,"integration_type": %{if(req.http.integration_type, "%u0022" + json.escape(req.http.integration_type) + "%u0022", "null")}V,"integration_version": %{if(req.http.integration_version, "%u0022" + json.escape(req.http.integration_version) + "%u0022", "null")}V,"method": "%{json.escape(req.method)}V","path": "%{json.escape(req.url.path)}V","mit_svc_latency":%{if(req.http.x-netacea:mit_svc_latency, "%u0022" + json.escape(req.http.x-netacea:mit_svc_latency) + "%u0022", "0")}V,"mit_status":%{if(req.http.x-netacea:mit_status, "%u0022" + json.escape(req.http.x-netacea:mit_status) + "%u0022", "0")}V,"protocol": "%{json.escape(req.proto)}V","query": "%{json.escape(req.url.qs)}V","referrer": %{if(req.http.referer, "%u0022" + json.escape(req.http.referer) + "%u0022", "null")}V,"request_time": %{time.elapsed}V,"status": "%{json.escape(resp.status)}V","user_agent": %{if(req.http.user-agent, "%u0022" + json.escape(req.http.user-agent) + "%u0022", "null")}V,"user_id": %{if(req.http.x-netacea-userid, "%u0022" + json.escape(req.http.x-netacea-userid) + "%u0022", "null")}V,"client_ja3_md5": %{if(tls.client.ja3_md5, "%u0022" + json.escape(tls.client.ja3_md5) + "%u0022", "null")}V,"x_forwarded_for": %{if(req.http.X-Forwarded-For, "%u0022" + json.escape(req.http.X-Forwarded-For) + "%u0022", "null")}V}

Timestamp

%Y-%m-%dT%H:%M:%S.000

Logging considerations

Fastly allows users to enable Host's feature called "Shielding" that has some benefits like reducing origin load, improving cache hit ratio, etc. Enabling this feature in a Fastly service that uses our Integration results in a duplication of logs.

When configuring Fastly log shipping by default, it will send all requests, including static & media content that is not required by Netacea. In order to solve this issue we need to add a Condition to the service and attach it to Netacea Logging.

  • Navigate to Conditions area

  • Click "Create Condition"

  • Enter the following details in the popup window:

Field
Value

Type

Response

Name

e.g. Netacea_Log_Visit

Apply if

(req.url !~ "/media/" && req.url !~ "/static/") && fastly.ff.visits_this_service == 0

Priority

10 (default)

  • Click "Save" and navigate to Logging area

  • Find Netacea Logging and click on the "Attach a condition"

  • In the popup window, select the newly created condition

Finishing Up

Check you have completed the following steps:

  • Ensure no error warnings are appearing

You are now ready to deploy the version you have been editing by clicking "Activate".

Log shipping will now be deployed on the service it was configured against. You can verify the deployment is correct by:

  • Reviewing the active version for the new log shipping job.

  • Requesting Netacea review internal ingest metrics.

  • Requesting Netacea validate the data content & format.

Last updated

Copyright Netacea 2023