1
#include "envoy/formatter/http_formatter_context.h"
2

            
3
#include "source/common/common/assert.h"
4
#include "source/common/common/empty_string.h"
5
#include "source/common/formatter/substitution_formatter.h"
6
#include "source/common/http/header_map_impl.h"
7
#include "source/common/http/utility.h"
8

            
9
namespace Envoy {
10
namespace Formatter {
11

            
12
static constexpr absl::string_view DEFAULT_FORMAT =
13
    "[%START_TIME%] "
14
    "\"%REQUEST_HEADER(:METHOD)% %REQUEST_HEADER(X-ENVOY-ORIGINAL-PATH?:PATH)% %PROTOCOL%\" "
15
    "%RESPONSE_CODE% "
16
    "%RESPONSE_FLAGS% "
17
    "%BYTES_RECEIVED% "
18
    "%BYTES_SENT% "
19
    "%DURATION% "
20
    "%RESPONSE_HEADER(X-ENVOY-UPSTREAM-SERVICE-TIME)% "
21
    "\"%REQUEST_HEADER(X-FORWARDED-FOR)%\" "
22
    "\"%REQUEST_HEADER(USER-AGENT)%\" "
23
    "\"%REQUEST_HEADER(X-REQUEST-ID)%\" "
24
    "\"%REQUEST_HEADER(:AUTHORITY)%\" "
25
    "\"%UPSTREAM_HOST%\"\n";
26

            
27
18948
absl::StatusOr<FormatterPtr> HttpSubstitutionFormatUtils::defaultSubstitutionFormatter() {
28
  // It is possible that failed to parse the default format string if the required formatters
29
  // are compiled out.
30
18948
  return Envoy::Formatter::FormatterImpl::create(DEFAULT_FORMAT, false);
31
18948
}
32

            
33
} // namespace Formatter
34
} // namespace Envoy