Skip to content
This repository has been archived by the owner on Dec 13, 2023. It is now read-only.

[waflog] logging format cannot be empty #71

Open
minus27 opened this issue Dec 20, 2018 · 3 comments
Open

[waflog] logging format cannot be empty #71

minus27 opened this issue Dec 20, 2018 · 3 comments

Comments

@minus27
Copy link

minus27 commented Dec 20, 2018

[waflog] logging format cannot be empty

Overview

  1. OS name and version.
    N/A
  2. go version output
    N/A
  3. waflyctl --version in recent releases or brew info waflyctl output.

Fastly WAF Control Tool version: 0.2.1 built on 2018-11-09T16:21:56Z by #team-soc

  1. Description of the problem. What is happening that shouldn't?
    I did not want to have waflyctl create a logging endpoint. After discovering that the [weblog] and [waflog] sections could not be removed from the toml file, I attempted to use this configuration:
[weblog]
name = "bogus-weblogs"
address = "10.0.0.1"
port = 514
tlscacert = ""
tlshostname = ""
format = ""
 
[waflog]
name = "bogus-waflogs"
address = "10.0.0.1"
port = 514
tlscacert = ""
tlshostname = ""
format = ""

Unfortunately, the empty format was magically transformed into the default format, i.e. %h %l %u %t "%r" %>s %b, which became an issue for the [waflog] configuration, but only after it was moved to waf_debug_log since some of the parameters in the default logging format are not accessible there. See below.
5. Description of the expected behaviour.
I expected to have an empty logging format since that is what I supplied, but that did not happen.
6. Exact steps to reproduce the error.
Put the above configuration into a toml file and run waflyctl.

Additional Information:

  1. Logs showing errors or behaviour.
    Error messages from the Fastly UI after VCL validation failed:
Variable `resp.status` not accessible in method `vcl_miss`

...in function `waf_debug_log`

...called from `waf_ruleset`

...called from `waf`

...called from `vcl_miss`

...which is the `vcl_miss` method
at: (input Line 9898 Pos 245)
  log {"syslog XXXXXXXXXX bogus-waflogs :: "} req.http.Fastly-Client-IP {" "-" "-" "} "[" strftime({"%d/%b/%Y:%H:%M:%S %z"}, time.start) "]" {" ""} cstr_escape(req.request) " " cstr_escape(req.url) " " cstr_escape(req.proto) {"" "} resp.status " " regsub(resp.body_bytes_written, "^0$", {""-""});
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------###########-----------------------------------------------------
  1. Steps which have been taken to try address the issue.
    I worked around my immediate problem by not using an empty logging format:
format = "{\"bogus\":true}"
  1. Other data which indicates what may be causing the issue.
    N/A
  2. Stack trace if any error is seen.
    N/A
@ejthurgo
Copy link
Contributor

@minus27 Would a CLI parameter which omits logging solve this?
Perhaps --omit-logging

@minus27
Copy link
Author

minus27 commented May 22, 2019 via email

@ejthurgo
Copy link
Contributor

Sounds to me that updating the config file validation makes sense. That way you're essentially able to change the default functionality and not have to explicitly opt-out of logs.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants