Fix mismatched sINT/dINT log field types - #13223
Conversation
Seven boolean/counter fields were declared dINT, but their marshal functions write a single int, and proxy_protocol_version (ppv) was declared dINT while it actually marshals a string. The dINT type wrongly excludes these fields from log filters and aggregates, and the ppv mislabeling misrepresents variable-length string bytes as two fixed ints to any type-driven consumer. Retype the single-int fields as sINT and ppv as STRING so the declared type matches what each marshal function emits.
There was a problem hiding this comment.
Pull request overview
This pull request corrects Apache Traffic Server’s access log field type declarations so they match what the corresponding marshal functions actually emit, which in turn restores expected behavior for type-driven consumers (e.g., filters/aggregates) and prevents incorrect interpretation in typed/binary contexts.
Changes:
- Retype seven single-int boolean/counter fields from
LogField::dINTtoLogField::sINTto match theirmarshal_int()behavior. - Retype
proxy_protocol_version(ppv) fromLogField::dINTtoLogField::STRINGto match its string marshalling. - Add clarifying enum comments for
LogField::Typevalues.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/proxy/logging/Log.cc | Updates the affected log field registrations to use sINT/STRING types consistent with their marshal functions. |
| include/proxy/logging/LogField.h | Adds brief documentation comments clarifying the meaning of sINT, dINT, and STRING. |
|
[approve ci autest 2of4] |
bneradt
left a comment
There was a problem hiding this comment.
Looks good. Thanks for fixing.
Is there any way to add compile time or other verification to catch these? Apparently it's an easy mistake for devs to make. We can keep this as a separate PR if you wish, if this is even possible.
|
Yeh, it's easy to mistake. To find the error, we need to count |
|
Cherry-picked to 10.2.x |
Seven boolean/counter fields were declared dINT, but their marshal functions write a single int, and proxy_protocol_version (ppv) was declared dINT while it actually marshals a string. The dINT type wrongly excludes these fields from log filters and aggregates, and the ppv mislabeling misrepresents variable-length string bytes as two fixed ints to any type-driven consumer. Retype the single-int fields as sINT and ppv as STRING so the declared type matches what each marshal function emits. (cherry picked from commit e91ce44)
|
Cherry-picked to 10.1.x branch |
Seven boolean/counter fields were declared dINT, but their marshal functions write a single int, and proxy_protocol_version (ppv) was declared dINT while it actually marshals a string. The dINT type wrongly excludes these fields from log filters and aggregates, and the ppv mislabeling misrepresents variable-length string bytes as two fixed ints to any type-driven consumer. Retype the single-int fields as sINT and ppv as STRING so the declared type matches what each marshal function emits. (cherry picked from commit e91ce44)
The cqssrt (client_req_ssl_resumption_type) log field added in #12404 was silently dropped from master by the 11-Dev integration merge (#12983, 8415cef). A criss-cross merge resolution removed its registration in Log.cc and the LogAccess marshal path, while the supporting HttpUserAgent::get_client_ssl_resumption_type() machinery survived, leaving that accessor as dead code with no caller. Re-register the field and re-add the marshal function plus the TransactionLogData bridge accessor so the orphaned machinery is wired back into the log system. Declare it as sINT (it marshals a single int), not the original dINT, matching the type/marshal-framing fix in #13223.
Seven boolean/counter fields were declared dINT, but their marshal functions write a single int, and proxy_protocol_version (ppv) was declared dINT while it actually marshals a string. The dINT type wrongly excludes these fields from log filters and aggregates, and the ppv mislabeling misrepresents variable-length string bytes as two fixed ints to any type-driven consumer. Retype the single-int fields as sINT and ppv as STRING so the declared type matches what each marshal function emits.
The cqssrt (client_req_ssl_resumption_type) log field added in apache#12404 was silently dropped from master by the 11-Dev integration merge (apache#12983, 8415cef). A criss-cross merge resolution removed its registration in Log.cc and the LogAccess marshal path, while the supporting HttpUserAgent::get_client_ssl_resumption_type() machinery survived, leaving that accessor as dead code with no caller. Re-register the field and re-add the marshal function plus the TransactionLogData bridge accessor so the orphaned machinery is wired back into the log system. Declare it as sINT (it marshals a single int), not the original dINT, matching the type/marshal-framing fix in apache#13223.
Seven boolean/counter fields were declared dINT, but their marshal functions write a single int, and proxy_protocol_version (ppv) was declared dINT while it actually marshals a string. The dINT type wrongly excludes these fields from log filters and aggregates, and the ppv mislabeling misrepresents variable-length string bytes as two fixed ints to any type-driven consumer. Retype the single-int fields as sINT and ppv as STRING so the declared type matches what each marshal function emits.
What happens on mismatch
I'm going to introduce a new binary logging format with self description of type, it depends on this fix.