Removing Log Prefix


#1

Hi all,

I am setting up a new logging endpoint in the Fastly UI and it seems that all of my log entries are prefixed with text similar to the following:

<123>2016-12-28T02:36:19Z cache-iadxxxx MyLog-Production[123123]:

Is there any way to remove this from my logs? Since I am logging to a particular endpoint for this service, I already know what service it belongs to. These extra characters waste storage with my log management solutions and will end up costing me more at scale.

Any help is appreciated. Thank you!


#2

Hi @jimfear

Your logging endpoint is currently set to our classic message format, but you can change that to blank which will remove the prefix data.

Here’s the link to the guide: https://docs.fastly.com/guides/streaming-logs/changing-log-line-formats

The API call will be (assuming blank is the message type you wish to use):

curl -X PUT -H 'Fastly-Key: <your Fastly API key>' -H 'Content-Type: application/json' 'https://api.fastly.com/service/<your Fastly service ID>/version/<version number/logging/<log type>/<log name>' --data-binary '{"message_type":"blank"}'

The guide has the list of possible values for log type Also, make sure your log name is URL encoded.