Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions doc/admin-guide/files/records.yaml.en.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4415,11 +4415,26 @@ QUIC Configuration
All configurations for QUIC are still experimental and may be changed or
removed in the future without prior notice.

.. ts:cv:: CONFIG proxy.config.quic.qlog_dir STRING NULL
.. ts:cv:: CONFIG proxy.config.quic.qlog.file_base STRING NULL
:reloadable:

The qlog is enabled when this configuration is not NULL. And will dump
the qlog to this dir.
Sets qlog output to a specific base file name. For a given file base name the file becomes
``{file_base}-{trace id}.sqlog``.
Absolute path or relative to the configured prefix can be used.
Qlog is emitted for each connection.

.. code-block:: yaml

ts:
quic:
qlog:
file_base: /my/logs/test1

The above configuration will make |TS| to generate Qlogs with the following format:

.. code-block:: bash

/my/logs/test1-e9158839e54cb8f34ab00d34236ad5e19a49.sqlog

.. ts:cv:: CONFIG proxy.config.quic.instance_id INT 0
:reloadable:
Expand Down
2 changes: 1 addition & 1 deletion iocore/net/QUICNetVConnection.cc
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ QUICNetVConnection::start()
this->_frame_dispatcher->add_handler(this->_handshake_handler);

// register qlog
if (this->_context->config()->qlog_dir() != nullptr) {
if (this->_context->config()->get_qlog_file_base_name() != nullptr) {
this->_qlog = std::make_unique<QLog::QLogListener>(*this->_context, this->_original_quic_connection_id.hex());
this->_qlog->last_trace().set_vantage_point(
{"ats", QLog::Trace::VantagePointType::server, QLog::Trace::VantagePointType::server});
Expand Down
8 changes: 5 additions & 3 deletions iocore/net/QUICPacketHandler_quiche.cc
Original file line number Diff line number Diff line change
Expand Up @@ -282,14 +282,16 @@ QUICPacketHandlerIn::_recv_packet(int event, UDPPacket *udp_packet)
&udp_packet->from.sa, udp_packet->from.isIp4() ? sizeof(udp_packet->from.sin) : sizeof(udp_packet->from.sin6),
&this->_quiche_config);

if (params->qlog_dir() != nullptr) {
if (params->get_qlog_file_base_name() != nullptr) {
char qlog_filepath[PATH_MAX];
const uint8_t *quic_trace_id;
size_t quic_trace_id_len = 0;
quiche_conn_trace_id(quiche_con, &quic_trace_id, &quic_trace_id_len);
snprintf(qlog_filepath, PATH_MAX, "%s/%.*s.sqlog", Layout::get()->relative(params->qlog_dir()).c_str(),
snprintf(qlog_filepath, PATH_MAX, "%s-%.*s.sqlog", Layout::get()->relative(params->get_qlog_file_base_name()).c_str(),
static_cast<int>(quic_trace_id_len), quic_trace_id);
quiche_conn_set_qlog_path(quiche_con, qlog_filepath, "ats", "");
if (auto success = quiche_conn_set_qlog_path(quiche_con, qlog_filepath, "Apache Traffic Server", "qlog"); !success) {
QUICDebug("quiche_conn_set_qlog_path failed to use %s", qlog_filepath);
}
}

vc = static_cast<QUICNetVConnection *>(getNetProcessor()->allocate_vc(nullptr));
Expand Down
13 changes: 8 additions & 5 deletions iocore/net/quic/QUICConfig.cc
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,9 @@ quic_init_client_ssl_ctx(const QUICConfigParams *params)
//
QUICConfigParams::~QUICConfigParams()
{
this->_server_supported_groups = (char *)ats_free_null(this->_server_supported_groups);
this->_client_supported_groups = (char *)ats_free_null(this->_client_supported_groups);
this->_server_supported_groups = static_cast<char *>(ats_free_null(this->_server_supported_groups));
this->_client_supported_groups = static_cast<char *>(ats_free_null(this->_client_supported_groups));
this->_qlog_file_base_name = static_cast<char *>(ats_free_null(this->_qlog_file_base_name));

SSL_CTX_free(this->_client_ssl_ctx.get());
};
Expand All @@ -117,7 +118,9 @@ QUICConfigParams::initialize()
REC_ReadConfigStringAlloc(this->_server_supported_groups, "proxy.config.quic.server.supported_groups");
REC_ReadConfigStringAlloc(this->_client_supported_groups, "proxy.config.quic.client.supported_groups");
REC_ReadConfigStringAlloc(this->_client_session_file, "proxy.config.quic.client.session_file");
REC_ReadConfigStringAlloc(this->_qlog_dir, "proxy.config.quic.qlog_dir");

// Qlog
REC_ReadConfigStringAlloc(this->_qlog_file_base_name, "proxy.config.quic.qlog.file_base");

// Transport Parameters
REC_EstablishStaticConfigInt32U(this->_no_activity_timeout_in, "proxy.config.quic.no_activity_timeout_in");
Expand Down Expand Up @@ -442,9 +445,9 @@ QUICConfigParams::client_session_file() const
}

const char *
QUICConfigParams::qlog_dir() const
QUICConfigParams::get_qlog_file_base_name() const
{
return this->_qlog_dir;
return this->_qlog_file_base_name;
}

//
Expand Down
7 changes: 5 additions & 2 deletions iocore/net/quic/QUICConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ class QUICConfigParams : public ConfigInfo
const char *server_supported_groups() const;
const char *client_supported_groups() const;
const char *client_session_file() const;
const char *qlog_dir() const;

// qlog
const char *get_qlog_file_base_name() const;

shared_SSL_CTX client_ssl_ctx() const;

Expand Down Expand Up @@ -106,7 +108,8 @@ class QUICConfigParams : public ConfigInfo
char *_server_supported_groups = nullptr;
char *_client_supported_groups = nullptr;
char *_client_session_file = nullptr;
char *_qlog_dir = nullptr;
// qlog
char *_qlog_file_base_name = nullptr;

shared_SSL_CTX _client_ssl_ctx = nullptr;

Expand Down
2 changes: 1 addition & 1 deletion iocore/net/quic/qlog/QLogListener.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class QLogListener : public QUICCallback
void
connection_close_callback(QUICCallbackContext &) override
{
this->_log.dump(this->_context.config()->qlog_dir());
this->_log.dump(this->_context.config()->get_qlog_file_base_name());
}

Trace &
Expand Down
2 changes: 1 addition & 1 deletion src/records/RecordsConfig.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1390,7 +1390,7 @@ static const RecordElement RecordsConfig[] =
,
{RECT_CONFIG, "proxy.config.quic.client.session_file", RECD_STRING, nullptr , RECU_RESTART_TS, RR_NULL, RECC_NULL, nullptr, RECA_NULL}
,
{RECT_CONFIG, "proxy.config.quic.qlog_dir", RECD_STRING, nullptr , RECU_RESTART_TS, RR_NULL, RECC_NULL, nullptr, RECA_NULL}
{RECT_CONFIG, "proxy.config.quic.qlog.file_base", RECD_STRING, nullptr , RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL}
,
// Transport Parameters
{RECT_CONFIG, "proxy.config.quic.no_activity_timeout_in", RECD_INT, "30000", RECU_DYNAMIC, RR_NULL, RECC_STR, "^-?[0-9]+$", RECA_NULL}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
'proxy.config.diags.debug.tags': 'traffic_dump|quic',
'proxy.config.http.insert_age_in_response': 0,

'proxy.config.quic.qlog_dir': qlog_dir,
'proxy.config.quic.qlog.file_base': qlog_dir,

'proxy.config.ssl.server.cert.path': ts.Variables.SSLDir,
'proxy.config.ssl.server.private_key.path': ts.Variables.SSLDir,
Expand Down
3 changes: 2 additions & 1 deletion tests/gold_tests/records/gold/full_records.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,8 @@ ts:
num_alt_connection_ids: 8
preferred_address_ipv4: null
preferred_address_ipv6: null
qlog_dir: null
qlog:
file_base: null
server:
quantum_readiness_test_enabled: 0
stateless_retry_enabled: 0
Expand Down
2 changes: 1 addition & 1 deletion tests/gold_tests/records/legacy_config/full_records.config
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ CONFIG proxy.config.quic.server.quantum_readiness_test_enabled INT 0
CONFIG proxy.config.quic.server.supported_groups STRING P-256:X25519:P-384:P-52
CONFIG proxy.config.quic.client.supported_groups STRING P-256:X25519:P-384:P-52
CONFIG proxy.config.quic.client.session_file STRING nullptr
CONFIG proxy.config.quic.qlog_dir STRING nullptr
CONFIG proxy.config.quic.qlog.file_base STRING nullptr
CONFIG proxy.config.quic.no_activity_timeout_in INT 30000
CONFIG proxy.config.quic.no_activity_timeout_out INT 30000
CONFIG proxy.config.quic.preferred_address_ipv4 STRING nullptr
Expand Down