Skip to content

Instantly share code, notes, and snippets.

@icodethings icodethings/base.vcl Secret
Created Apr 26, 2018

Embed
What would you like to do?
fastly-cache-log-vcl
include "json_generate.vcl";
sub vcl_log {
#FASTLY log
call json_generate_reset;
call json_generate_begin_object;
set req.http.value = "url";
call json_generate_string;
set req.http.value = req.url;
call json_generate_string;
set req.http.value = "cacheNode";
call json_generate_string;
set req.http.value = server.identity;
call json_generate_string;
set req.http.value = "method";
call json_generate_string;
set req.http.value = req.request;
call json_generate_string;
set req.http.value = "httpStatus";
call json_generate_string;
set req.http.value = resp.status;
call json_generate_number;
set req.http.value = "bytesWritten";
call json_generate_string;
set req.http.value = resp.bytes_written;
call json_generate_number;
set req.http.value = "fastlyState";
call json_generate_string;
set req.http.value = fastly_info.state;
call json_generate_string;
set req.http.value = "timestamp";
call json_generate_string;
set req.http.value = time.start;
call json_generate_string;
set req.http.value = "timeElapsed";
call json_generate_string;
set req.http.value = time.elapsed.usec;
call json_generate_number;
call json_generate_end_object;
log {"syslog [ID] S3 - Cache log :: "} req.http.json_generate_json;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.