alficles commented on a change in pull request #2922: Update logging.config
generation to allow additional types and logging filters
URL: https://github.com/apache/trafficcontrol/pull/2922#discussion_r235164369
##########
File path: traffic_ops/app/lib/API/Configs/ApacheTrafficServer.pm
##########
@@ -1451,24 +1449,51 @@ sub logging_dot_config {
$text .= " Format = '" . $format . " '\n";
$text .= "}\n";
}
+ }
+
+ for ( my $i = 0; $i < $max_log_objects; $i = $i + 1) {
+ my $log_filter_field = "LogFilter";
+ if ( $i > 0 ) {
+ $log_filter_field = $log_filter_field . "$i";
+ }
+ my $log_filter_name = $data->{$log_filter_field . ".Name"} ||
"";
+ if ( length($log_filter_name) > 0) {
+ my $filter = $data->{$log_filter_field . ".Filter"};
+ my $log_filter_type = $data->{$log_filter_field .
".Type"} || "accept";
+ $text .= $log_filter_name . " = filter." .
$log_filter_type . "('" . $filter . "')\n";
Review comment:
I like this much better. It's got one tiny issue left, I think. If `$filter`
contains any single-quotes or backslashes, they will need to be escaped.
Also, I went back and checked. The only reason we're escaping double-quotes
in the `$format` is that we used to put `$format` into an XML string that used
quotes. We now harmlessly but pointlessly escape double quotes in the
`$format`, but fail to usefully escape the single-quotes we now use.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services