cli
cli copied to clipboard
Should the 'format' field be removed from the `logging <provider> describe` commands?
Version
Fastly CLI version v0.38.0-3-gcd01012 (cd01012)
What happened
Running the following command:
fastly logging splunk describe --name <name> --version latest -s <service id for a C@E service>
Shows:
Service ID: <REDACTED>
Version: <REDACTED>
Name: <REDACTED>
URL: <REDACTED>
Token: <REDACTED>
TLS CA certificate: -----BEGIN CERTIFICATE-----
<REDACTED>
-----END CERTIFICATE-----
TLS hostname: <REDACTED>
TLS client certificate: -----BEGIN CERTIFICATE-----
<REDACTED>
-----END CERTIFICATE-----
TLS client key: -----BEGIN RSA PRIVATE KEY-----
<REDACTED>
-----END RSA PRIVATE KEY-----
Format: {
"timestamp":"%{begin:%Y-%m-%dT%H:%M:%S}t",
"client_ip":"%{req.http.Fastly-Client-IP}V",
"geo_city":"%{client.geo.city}V",
"url":"%{json.escape(req.url)}V",
"request_referer":"%{json.escape(req.http.referer)}V",
"request_user_agent":"%{json.escape(req.http.User-Agent)}V",
"fastly_is_edge":%{if(fastly.ff.visits_this_service == 0, "true", "false")}V,
"response_state":"%{json.escape(fastly_info.state)}V",
"response_status":%{resp.status}V,
"response_reason":%{if(resp.response, "%22"+json.escape(resp.response)+"%22", "null")}V,
"response_body_size":%{resp.body_bytes_written}V,
"request_method":"%{json.escape(req.method)}V",
"request_protocol":"%{json.escape(req.proto)}V",
"fastly_server":"%{json.escape(server.identity)}V",
"host":"%{if(req.http.Fastly-Orig-Host, req.http.Fastly-Orig-Host, req.http.Host)}V"
}
Format version: 2
Response condition:
Placement: none
However, the format is ignored and the UI is no longer displaying it. Perhaps the CLI should do the same? Note: this might not be limited to Splunk.
👋🏻 @fgsch
re:
However, the format is ignored and the UI is no longer displaying it. Perhaps the CLI should do the same?
So what is the issue here?
From what I can tell, the API documentation shows format as a field that is returned from the API (and as such we should return it as part of the go-fastly API client, and consequently the CLI too).
You mentioned it's not shown in the Fastly UI (e.g. manage.fastly.com) but then I guess that has a slightly different use case to the underlying API itself.
I'm thinking this issue should be closed but let me know your thoughts.
In the past we had many queries about the format for C@E services. IMO showing this field for such services affects the UX, as the format is not used and had, and still might, confuse users.
Feel free to close it if you disagree.
Ahhh, sorry, I've only just noticed you said service id for a C@E service
So, the issue (as far as I understand) is with the Fastly API returning a format field regardless of the service type (e.g. it should only be returned for a "Deliver" service but not a "Compute" service).
If so, then OK we should probably do a lookup for the service type and only include the format field if it's a "Deliver" service.