1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565
|
<pre>Internet Engineering Task Force (IETF) G. Salgueiro
Request for Comments: 6873 Cisco Systems
Category: Standards Track V. Gurbani
ISSN: 2070-1721 Bell Labs, Alcatel-Lucent
A. B. Roach
Mozilla
February 2013
<span class="h1">Format for the Session Initiation Protocol (SIP)</span>
<span class="h1">Common Log Format (CLF)</span>
Abstract
The SIPCLF working group has defined a Common Log Format (CLF)
framework for Session Initiation Protocol (SIP) servers. This CLF
mimics the successful event logging format found in well-known web
servers like Apache and web proxies like Squid. This document
proposes an indexed text encoding format for the SIP CLF that retains
the key advantages of a text-based format while significantly
increasing processing performance over a purely text-based
implementation. This file format adheres to the SIP CLF information
model and provides an effective encoding scheme for all mandatory and
optional fields that appear in a SIP CLF record.
Status of This Memo
This is an Internet Standards Track document.
This document is a product of the Internet Engineering Task Force
(IETF). It represents the consensus of the IETF community. It has
received public review and has been approved for publication by the
Internet Engineering Steering Group (IESG). Further information on
Internet Standards is available in <a href="./rfc5741#section-2">Section 2 of RFC 5741</a>.
Information about the current status of this document, any errata,
and how to provide feedback on it may be obtained at
<a href="http://www.rfc-editor.org/info/rfc6873">http://www.rfc-editor.org/info/rfc6873</a>.
<span class="grey">Salgueiro, et al. Standards Track [Page 1]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-2" ></span>
<span class="grey"><a href="./rfc6873">RFC 6873</a> Format for SIP CLF February 2013</span>
Copyright Notice
Copyright (c) 2013 IETF Trust and the persons identified as the
document authors. All rights reserved.
This document is subject to <a href="https://www.rfc-editor.org/bcp/bcp78">BCP 78</a> and the IETF Trust's Legal
Provisions Relating to IETF Documents
(<a href="http://trustee.ietf.org/license-info">http://trustee.ietf.org/license-info</a>) in effect on the date of
publication of this document. Please review these documents
carefully, as they describe your rights and restrictions with respect
to this document. Code Components extracted from this document must
include Simplified BSD License text as described in Section 4.e of
the Trust Legal Provisions and are provided without warranty as
described in the Simplified BSD License.
Table of Contents
<a href="#section-1">1</a>. Introduction ....................................................<a href="#page-3">3</a>
<a href="#section-2">2</a>. Terminology .....................................................<a href="#page-3">3</a>
<a href="#section-3">3</a>. Document Conventions ............................................<a href="#page-4">4</a>
<a href="#section-4">4</a>. Format ..........................................................<a href="#page-5">5</a>
<a href="#section-4.1">4.1</a>. Index Pointers .............................................<a href="#page-8">8</a>
<a href="#section-4.2">4.2</a>. Mandatory Fields ..........................................<a href="#page-10">10</a>
<a href="#section-4.3">4.3</a>. SIP CLF Encoding and Character Escaping Requirements ......<a href="#page-13">13</a>
<a href="#section-4.4">4.4</a>. Optional Fields ...........................................<a href="#page-14">14</a>
<a href="#section-5">5</a>. Example SIP CLF Record .........................................<a href="#page-22">22</a>
<a href="#section-6">6</a>. Text Tool Considerations .......................................<a href="#page-24">24</a>
<a href="#section-7">7</a>. Security Considerations ........................................<a href="#page-24">24</a>
<a href="#section-8">8</a>. Operational Guidance ...........................................<a href="#page-25">25</a>
<a href="#section-9">9</a>. IANA Considerations ............................................<a href="#page-25">25</a>
<a href="#section-9.1">9.1</a>. SIP CLF Version ...........................................<a href="#page-25">25</a>
<a href="#section-9.2">9.2</a>. SIP CLF Transport Flag ....................................<a href="#page-26">26</a>
<a href="#section-10">10</a>. Acknowledgments ...............................................<a href="#page-26">26</a>
<a href="#section-11">11</a>. References ....................................................<a href="#page-27">27</a>
<a href="#section-11.1">11.1</a>. Normative References .....................................<a href="#page-27">27</a>
<a href="#section-11.2">11.2</a>. Informative References ...................................<a href="#page-27">27</a>
<span class="grey">Salgueiro, et al. Standards Track [Page 2]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-3" ></span>
<span class="grey"><a href="./rfc6873">RFC 6873</a> Format for SIP CLF February 2013</span>
<span class="h2"><a class="selflink" id="section-1" href="#section-1">1</a>. Introduction</span>
The extensive list of benefits and the widespread adoption of the
Apache Common Log Format (CLF) has prompted the development of an
analogous event logging mechanism for the Session Initiation Protocol
(SIP) [<a href="./rfc3261" title=""SIP: Session Initiation Protocol"">RFC3261</a>]. Implementing a logging scheme for SIP is a
considerable challenge. In part, this is due to the fact that the
behavior of a SIP entity is more complex as compared to an HTTP
entity. Additionally, there are shortcomings to the purely text-
based HTTP CLF that need to be addressed in order to allow for real-
time inspection of SIP log files [<a href="./rfc6872" title=""The Common Log Format (CLF) for the Session Initiation Protocol (SIP): Framework and Information Model"">RFC6872</a>]. Experience with Apache
CLF has shown that dealing with large quantities of log data can be
very processor intensive, as doing so necessarily requires reading
and parsing every byte in the log file(s) of interest.
An implementation-independent framework for the SIP CLF has been
defined in [<a href="./rfc6872" title=""The Common Log Format (CLF) for the Session Initiation Protocol (SIP): Framework and Information Model"">RFC6872</a>]. This memo describes an indexed text file
format for logging SIP messages received and sent by SIP clients,
servers, and proxies that adheres to the information model presented
in <a href="./rfc6872#section-8">Section 8 of [RFC6872]</a>. This document defines a format that is no
more difficult to generate by logging entities than standard (i.e.,
non-indexed) text log formats, while being radically faster to
process. In particular, the format is optimized for both rapidly
scanning through log records and quickly locating commonly accessed
data fields.
Further, the format proposed by this document retains the key
advantage of being human readable and able to be processed using the
various Unix text processing tools, such as sed, awk, perl, cut, and
grep.
<span class="h2"><a class="selflink" id="section-2" href="#section-2">2</a>. Terminology</span>
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
"SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
document are to be interpreted as described in [<a href="./rfc2119" title=""Key words for use in RFCs to Indicate Requirement Levels"">RFC2119</a>].
"SHOULD", "SHOULD NOT", "RECOMMENDED", and "NOT RECOMMENDED" are
appropriate when valid exceptions to a general requirement are known
to exist or appear to exist, and it is infeasible or impractical to
enumerate all of them. However, they should not be interpreted as
permitting implementers to fail to implement the general requirement
when such failure would result in interoperability failure.
<span class="grey">Salgueiro, et al. Standards Track [Page 3]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-4" ></span>
<span class="grey"><a href="./rfc6873">RFC 6873</a> Format for SIP CLF February 2013</span>
[<a id="ref-RFC3261">RFC3261</a>] defines additional terms used in this document that are
specific to the SIP domain such as "proxy"; "registrar"; "redirect
server"; "user agent server" or "UAS"; "user agent client" or "UAC";
"back-to-back user agent" or "B2BUA"; "dialog"; "transaction";
"server transaction".
This document uses the term "SIP Server" that is defined to include
the following SIP entities: user agent server, registrar, redirect
server, a SIP proxy in the role of user agent server, and a B2BUA in
the role of a user agent server.
The reader is expected to be familiar with the terminology and
concepts defined in [<a href="./rfc6872" title=""The Common Log Format (CLF) for the Session Initiation Protocol (SIP): Framework and Information Model"">RFC6872</a>].
<span class="h2"><a class="selflink" id="section-3" href="#section-3">3</a>. Document Conventions</span>
This document defines the logging syntax for the SIP CLF. This
syntax is demonstrated through the use of various examples. The
formatting described here does not permit these examples to be
unambiguously rendered due to the constraints imposed by the
formatting rules for RFCs. To avoid ambiguity and to meet the RFC
layout requirements, this document uses the <allOneLine/> markup
convention established in [<a href="./rfc4475" title=""Session Initiation Protocol (SIP) Torture Test Messages"">RFC4475</a>].
For the sake of clarity and completeness, the entire text defining
this markup convention from <a href="./rfc4475#section-2.1">Section 2.1 of [RFC4475]</a> is quoted below:
Several of these examples contain unfolded lines longer than 72
characters. These are captured between <allOneLine/> tags. The
single unfolded line is reconstructed by directly concatenating
all lines appearing between the tags (discarding any line feeds or
carriage returns). There will be no whitespace at the end of
lines. Any whitespace appearing at a fold-point will appear at
the beginning of a line.
The following represent the same string of bits:
Header-name: first value, reallylongsecondvalue, third value
<allOneLine>
Header-name: first value,
reallylongsecondvalue
, third value
</allOneLine>
<span class="grey">Salgueiro, et al. Standards Track [Page 4]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-5" ></span>
<span class="grey"><a href="./rfc6873">RFC 6873</a> Format for SIP CLF February 2013</span>
<allOneLine>
Header-name: first value,
reallylong
second
value,
third value
</allOneLine>
Note that this is NOT SIP header-line folding, where different
strings of bits have equivalent meaning.
The IP addresses used in the examples in this document correspond to
the documentation address block 192.0.2.0/24 (TEST-NET-1) as
described in [<a href="./rfc5737" title=""IPv4 Address Blocks Reserved for Documentation"">RFC5737</a>].
<span class="h2"><a class="selflink" id="section-4" href="#section-4">4</a>. Format</span>
The CLF for the Session Initiation Protocol [<a href="./rfc6872" title=""The Common Log Format (CLF) for the Session Initiation Protocol (SIP): Framework and Information Model"">RFC6872</a>] defines an
information model to which this logging format adheres, and <a href="#section-8.1">Section</a>
<a href="#section-8.1">8.1</a> of that document defines all the mandatory information model
elements.
This document defines the format of SIP CLF records as follows:
0 7 8 15 16 23 24 31
+-----------+-----------+-----------+-----------+
| Version | Record Length | 0 - 3
+-----------+-----------+-----------+-----------+
| Record Length (cont) | 0x2C | 4 - 7
+-----------+-----------+-----------+-----------+
| CSeq Pointer (Hex) | 8 - 11
+-----------+-----------+-----------+-----------+
| Response Status-Code Pointer (Hex) | 12 - 15
+-----------+-----------+-----------+-----------+
| R-URI Pointer (Hex) | 16 - 19
+-----------+-----------+-----------+-----------+
| Destination IP address:port Pointer (Hex) | 20 - 23
+-----------+-----------+-----------+-----------+
| Source IP address:port Pointer (Hex) | 24 - 27
+-----------+-----------+-----------+-----------+
| To URI Pointer (Hex) | 28 - 31
+-----------+-----------+-----------+-----------+
| To Tag Pointer (Hex) | 32 - 35
+-----------+-----------+-----------+-----------+
| From URI Pointer (Hex) | 36 - 39
+-----------+-----------+-----------+-----------+
| From Tag Pointer (Hex) | 40 - 43
+-----------+-----------+-----------+-----------+
<span class="grey">Salgueiro, et al. Standards Track [Page 5]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-6" ></span>
<span class="grey"><a href="./rfc6873">RFC 6873</a> Format for SIP CLF February 2013</span>
| Call-Id Pointer (Hex) | 44 - 47
+-----------+-----------+-----------+-----------+
| Server-Txn Pointer (Hex) | 48 - 51
+-----------+-----------+-----------+-----------+
| Client-Txn Pointer (Hex) | 52 - 55
+-----------+-----------+-----------+-----------+
| Optional Fields Start Pointer (Hex) | 56 - 59
+-----------+-----------+-----------+-----------+
| 0x0A | | 60 - 63
+-----------+ +
| Timestamp | 64 - 67
+ +-----------+
| | 0x2E | 68 - 71
+-----------+-----------+-----------+-----------+
| Fractional Seconds | 0x09 | 72 - 75
+-----------+-----------+-----------+-----------+
| Flags Field | 76 - 79
+-----------+-----------+-----------+-----------+
|Flag (cont)| 0x09 | | 80 - 83
|-----------+-----------+ |
| |
| |
| Mandatory Fields (variable length) |
| |
| |
+-----------+-----------+-----------+-----------+
| 0x09 | Tag | 0x40 |\
+-----------+-----------+-----------+-----------+ \
| Vendor-ID | \
+-----------+-----------+-----------+-----------+ \
| Vendor-ID (cont) | \ Repeated
+-----------+-----------+-----------+-----------+ \ as many
| 0x2C | Length (Hex) | > times as
+-----------+-----------+-----------+-----------+ / necessary
| Len (cont)| 0x2C | BEB | 0x2C | /
+-----------+-----------+-----------------------| /
| | /
| Value (variable length) | /
| |/
+-----------+-----------+-----------+-----------+
| 0x0A |
+-----------+
Figure 1: SIP Common Log Format
The format presented in Figure 1 is for a single SIP CLF log entry.
While there is no actual subdivision in practice, this format can be
logically subdivided into the following three distinct components:
<span class="grey">Salgueiro, et al. Standards Track [Page 6]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-7" ></span>
<span class="grey"><a href="./rfc6873">RFC 6873</a> Format for SIP CLF February 2013</span>
1. Index Pointers: The first 60 bytes of this format. This portion
is metadata, primarily composed of a list of pointers that
indicate the beginning of both the variable-length mandatory and
optional fields that are logged as part of this record. These
pointers are implemented as a mechanism to improve processing of
these records and to allow a reader to expeditiously skip
directly to the desired field without unnecessarily going through
the entire record. This logical subdivision within the SIP CLF
format will be referenced in this document with the
<IndexPointers> tag. A 0x0A (LF character) delimits
<IndexPointers> from the next logical grouping.
2. Mandatory Fields: The next logical grouping in this format is a
Tab-delimited (0x09) listing of the mandatory fields as described
in <a href="./rfc6872#section-8.1">Section 8.1 of [RFC6872]</a> and in the order listed in
<IndexPointers>. This logical subdivision within the SIP CLF
format will be referenced in this document with the
<MandatoryFields> tag.
3. Optional Fields: The last logical component MAY be present as it
is an OPTIONAL extension to the SIP CLF format. Its purpose is
to provide flexibility to the developer of this SIP CLF to log
any desired fields not included in <MandatoryFields>. This
includes SIP bodies and any vendor-specific extensions. This
logical subdivision within the SIP CLF format will be referenced
in this document with the <OptionalFields> tag.
This logical structure of the SIP CLF record format can be
graphically represented as shown in Figure 2 below:
<IndexPointers>
<MandatoryFields>
<OptionalFields>
Figure 2: Logical Structure of the SIP CLF Record
Note that Figures 1 and 2 plus the terminating line-feed (0x0A) at
the end of the SIP CLF record are different representations of the
same format but are functionally equivalent. The representation of
this format is a two-line record where the <IndexPointers> metadata
is on one line and the actual data like <MandatoryFields> and
<OptionalFields> (if present) is on another.
In the following sections note that indications of "hexadecimal
encoded" indicate values that are always unsigned and are to be
written out in human-readable base-16 numbers using the UTF-8
characters 0x30 through 0x39 ('0' through '9') and 0x41 through 0x46
('A' through 'F'). Similarly, indications of "decimal encoded"
<span class="grey">Salgueiro, et al. Standards Track [Page 7]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-8" ></span>
<span class="grey"><a href="./rfc6873">RFC 6873</a> Format for SIP CLF February 2013</span>
indicate that the value is to be written out in human-readable
base-10 numbers using the UTF-8 characters 0x30 through 0x39 ('0'
through '9'). In both encodings, numbers always take up the number
of bytes indicated and are padded on the left with UTF-8 '0' (zero)
characters to fill the entire space.
<span class="h3"><a class="selflink" id="section-4.1" href="#section-4.1">4.1</a>. Index Pointers</span>
The <IndexPointers> portion of the SIP CLF record (shown in Figure 3)
is a 60-byte header that indicates metadata about the record.
0 7 8 15 16 23 24 31
+-----------+-----------+-----------+-----------+
| Version | Record Length | 0 - 3
+-----------+-----------+-----------+-----------+
| Record Length (cont) | 0x2C | 4 - 7
+-----------+-----------+-----------+-----------+
| CSeq Pointer (Hex) | 8 - 11
+-----------+-----------+-----------+-----------+
| Response Status-Code Pointer (Hex) | 12 - 15
+-----------+-----------+-----------+-----------+
| R-URI Pointer (Hex) | 16 - 19
+-----------+-----------+-----------+-----------+
| Destination IP address:port Pointer (Hex) | 20 - 23
+-----------+-----------+-----------+-----------+
| Source IP address:port Pointer (Hex) | 24 - 27
+-----------+-----------+-----------+-----------+
| To URI Pointer (Hex) | 28 - 31
+-----------+-----------+-----------+-----------+
| To Tag Pointer (Hex) | 32 - 35
+-----------+-----------+-----------+-----------+
| From URI Pointer (Hex) | 36 - 39
+-----------+-----------+-----------+-----------+
| From Tag Pointer (Hex) | 40 - 43
+-----------+-----------+-----------+-----------+
| Call-Id Pointer (Hex) | 44 - 47
+-----------+-----------+-----------+-----------+
| Server-Txn Pointer (Hex) | 48 - 51
+-----------+-----------+-----------+-----------+
| Client-Txn Pointer (Hex) | 52 - 55
+-----------+-----------+-----------+-----------+
| Optional Fields Start Pointer (Hex) | 56 - 59
+-----------+-----------+-----------+-----------+
Figure 3: Index Pointers
<span class="grey">Salgueiro, et al. Standards Track [Page 8]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-9" ></span>
<span class="grey"><a href="./rfc6873">RFC 6873</a> Format for SIP CLF February 2013</span>
The fields that make up <IndexPointers> are described below:
Version (1 byte): UTF-8 encoded version for the SIP CLF record.
Range of valid values for the Version is from 'A' (0x41) to 'Z'
(0x5A). This document uses a Version value of "0x41" ('A').
The value of the SIP CLF Version MUST be incremented for any new
SIP CLF specification that changes any part of the SIP CLF record
format. The SIP CLF Version values are IANA-assigned
(<a href="#section-9.1">Section 9.1</a>) via the Standards Action method described in
[<a href="./rfc5226" title="">RFC5226</a>].
Since the version is specified per record, it is possible that a
SIP CLF log file could contain records with different versions.
Under normal operating conditions, this is an unlikely occurrence
and SHOULD be avoided if possible.
Record Length (6 bytes): Hexadecimal encoded total length of this
log record, beginning with the "Version" octet and ending with the
terminating line-feed.
Bytes 8 through 55 contain hexadecimal encoded pointers that point to
the starting location of each of the variable-length mandatory
fields. Bytes 56 through 59 contain a hexadecimal encoded pointer
that points to the starting location of the optional fields portion
of the SIP CLF record. Note that there are no delimiters between
these pointer values -- they are packed together as a single, 52-
character hexadecimal encoded string. The "Pointer" fields indicate
absolute byte values within the record, and are therefore >=82. They
point to the start of the corresponding value within the
<MandatoryFields> portion. A description of each of the mandatory
fields that these pointer values point to can be found in
<a href="#section-4.2">Section 4.2</a>.
Optional Fields Start Pointer: This final pointer indicates the
location within the SIP CLF record where the OPTIONAL group of
<OptionalFields> begin, if present. The "Optional Fields Start
Pointer" points to the UTF-8 Tab (0x09) character for the first
entry in the <OptionalFields> portion. If the OPTIONAL group of
<OptionalFields> are not implemented, then the "Optional Fields
Start Pointer" field MUST point to the terminating line-feed
(0x0A) at the end of the SIP CLF record.
<span class="grey">Salgueiro, et al. Standards Track [Page 9]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-10" ></span>
<span class="grey"><a href="./rfc6873">RFC 6873</a> Format for SIP CLF February 2013</span>
<span class="h3"><a class="selflink" id="section-4.2" href="#section-4.2">4.2</a>. Mandatory Fields</span>
The <MandatoryFields> portion of the SIP CLF record is shown below:
0 7 8 15 16 23 24 31
+-----------+-----------+-----------+-----------+
| 0x0A | | 60 - 63
+-----------+ +
| Timestamp | 64 - 67
+ +-----------+
| | 0x2E | 68 - 71
+-----------+-----------+-----------+-----------+
| Fractional Seconds | 0x09 | 72 - 75
+-----------+-----------+-----------+-----------+
| Flags Field | 76 - 79
+-----------+-----------+-----------+-----------+
|Flag (cont)| 0x09 | | 80 - 83
|-----------+-----------+ |
| |
| |
| Mandatory Fields (variable length) |
| |
| |
+-----------+-----------+-----------+-----------+
Figure 4: Mandatory Fields
Following the pointers in <IndexPointers>, two fixed-length fields
are encoded to specify the exact time of the log entry. As before,
all fields are completely filled, pre-pending values with '0'
characters as necessary.
Timestamp (10 bytes): Decimal encoded date and time of the request
or response represented as the number of seconds since the Unix
epoch (i.e., seconds since midnight, January 1st, 1970, GMT).
Fractional Seconds (3 bytes): Decimal encoded fractional seconds
portion of the Timestamp field to millisecond accuracy.
The combined Timestamp and Fractional Seconds fields are
represented in the log file as a UTF-8 encoded string representing
the date and time of the request or response represented as the
number of seconds and milliseconds since the Unix epoch. The
number of milliseconds is separated by a "." (UTF-8 character
0x2E) from the number of seconds.
<span class="grey">Salgueiro, et al. Standards Track [Page 10]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-11" ></span>
<span class="grey"><a href="./rfc6873">RFC 6873</a> Format for SIP CLF February 2013</span>
Flags Field (5 bytes):
byte 1 - Request/Response Flag
R = Request
r = Response
byte 2 - Retransmission Flag
O = Original transmission
D = Duplicate transmission
S = Server is stateless [i.e., retransmissions are not
detected]
byte 3 - Sent/Received Flag
S = Sent message
R = Received message
byte 4 - Transport Flag
The Transport Flag values are IANA-assigned (<a href="#section-9.2">Section 9.2</a>) via
the IETF Review method described in [<a href="./rfc5226" title="">RFC5226</a>]. Currently,
registered values are:
U = UDP
T = TCP
S = SCTP
byte 5 - Encryption Flag
E = Encrypted message (TLS, DTLS, etc.)
U = Unencrypted message
After the "Timestamp", "Fractional Seconds", and the "Flags" fields
are the values for the mandatory fields specified in <a href="./rfc6872#section-8.1">Section 8.1 of
[RFC6872]</a>, which are described below:
CSeq: The Command Sequence header field, including the CSeq number
and method name.
Response Status-Code: Set to the value of the SIP response status
code for responses. Set to a single UTF-8 dash (0x2D) for
requests.
R-URI: The Request-URI in the start line (mandatory in request),
including any URI parameters.
<span class="grey">Salgueiro, et al. Standards Track [Page 11]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-12" ></span>
<span class="grey"><a href="./rfc6873">RFC 6873</a> Format for SIP CLF February 2013</span>
Destination IP address:port: The IP address of the downstream server
and the port number, separated by a single ':'. IPv4 addresses
are represented in "dotted decimal" notation as per [<a href="./rfc1166" title=""Internet numbers"">RFC1166</a>].
IPv6 addresses are represented using the hexadecimal notation
detailed in <a href="./rfc5952#section-4">Section 4 of [RFC5952]</a> (or the special-case mixed
hexadecimal and decimal notation detailed in <a href="./rfc5952#section-5">Section 5 of
[RFC5952]</a>) and enclosed in square brackets ('[' and ']').
Source IP address:port: The IP address of the upstream client and
the port number over which the SIP message was received, separated
by a single ':'. IPv4 addresses are represented in "dotted
decimal" notation as per [<a href="./rfc1166" title=""Internet numbers"">RFC1166</a>]. IPv6 addresses are
represented using the hexadecimal notation detailed in <a href="./rfc5952#section-4">Section 4
of [RFC5952]</a> (or the special-case mixed hexadecimal and decimal
notation detailed in <a href="./rfc5952#section-5">Section 5 of [RFC5952]</a>) and enclosed in
square brackets ('[' and ']').
To URI: Value of the URI in the To header field.
To Tag: Value of the tag parameter (if present) in the To header
field.
From URI: Value of the URI in the From header field.
From Tag: Value of the tag parameter (if present) in the From header
field.
Call-Id: The value of the Call-ID header field.
Server transaction identification code (Server-Txn): The transaction
identifier associated with the server transaction.
Implementations can reuse the server transaction identifier (the
topmost branch-id of the incoming request, with or without the
magic cookie), or they could generate a unique identification
string for a server transaction (this identifier needs to be
locally unique to the server only). This identifier is used to
correlate ACKs and CANCELs to an INVITE transaction; it is also
used to aid in tracking forking. (See <a href="./rfc6872#section-9">Section 9 of [RFC6872]</a> for
usage.)
Client transaction identification code (Client-Txn): This field is
used to associate client transactions with a server transaction
for forking proxies or B2BUAs. Upon forking, implementations can
reuse the value they inserted into the topmost Via header's branch
parameter, or they can generate a unique identification string for
the client transaction. (See <a href="./rfc6872#section-9">Section 9 of [RFC6872]</a> for usage.)
<span class="grey">Salgueiro, et al. Standards Track [Page 12]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-13" ></span>
<span class="grey"><a href="./rfc6873">RFC 6873</a> Format for SIP CLF February 2013</span>
Note: The definitions of the Server-Txn and Client-Txn are taken
directly from [<a href="./rfc6872" title=""The Common Log Format (CLF) for the Session Initiation Protocol (SIP): Framework and Information Model"">RFC6872</a>] and are provided here only as a
convenience to the implementer. The definitions specified in
[<a href="./rfc6872" title=""The Common Log Format (CLF) for the Session Initiation Protocol (SIP): Framework and Information Model"">RFC6872</a>] should be considered authoritative in the event of a
conflict.
This data MUST appear in the order listed in <IndexPointers>, and
each field MUST be present. Fields are subject the maximum SIP CLF
field size of 4096 bytes as detailed in <a href="./rfc6872#section-8">Section 8 of [RFC6872]</a>.
<span class="h3"><a class="selflink" id="section-4.3" href="#section-4.3">4.3</a>. SIP CLF Encoding and Character Escaping Requirements</span>
The mandatory fields in a SIP CLF record are separated by a single
UTF-8 Tab character (0x09). Any Tab characters present in the data
to be written will be replaced by a UTF-8 space character (0x20)
prior to being logged.
The decision to replace tabs with spaces was based on there being no
standardized use of tabs in SIP headers to convey any other meaning
than whitespace. Tabs may appear in message bodies, and in the event
that the bodies are logged, the conversion to space may cause
problems when reconstructing the body from the corresponding log
entry. Two consequences of the decision to replace Tab with a space
character are: (a) it will become impossible to reconstruct a
signature over the logged field that matches the signature over
fields in the original SIP message, and (b) any future SIP header
fields that include tabs with a different semantic meaning than
simply signifying whitespace will lose this meaning when logged.
Finally, the tabs-to-spaces substitution MUST occur when logging
mandatory fields and optional SIP Header Field or Reason-Phrase
(Tag=00); it MUST also occur when optionally logging either the
entire message (Tag=02) or simply a SIP body (Tag=01) as described in
<a href="#section-4.4">Section 4.4</a>.
An element will not always have an appropriate value to provide for
one of these fields, even when the field is required to appear in the
SIP CLF record. In such circumstances, when a given mandatory field
from <a href="#section-4.2">Section 4.2</a> and specified in <a href="./rfc6872#section-8.1">Section 8.1 of [RFC6872]</a>) is not
present, then that empty field MUST be encoded as a single horizontal
dash ("-"). In the event that a field failed to parse, it MUST be
encoded as a single question mark ("?"). If these characters are
part of a sequence of other characters, then there is no ambiguity.
If the field being logged contains only one character, and that
character is the literal "-", the implementation SHOULD insert an
escaped %2D for that field in the SIP CLF record. Similarly, if the
field contains only one character, and that character is the literal
"?", the implementation SHOULD insert an escaped %3F for that field
in the SIP CLF record.
<span class="grey">Salgueiro, et al. Standards Track [Page 13]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-14" ></span>
<span class="grey"><a href="./rfc6873">RFC 6873</a> Format for SIP CLF February 2013</span>
The terminating carriage return line feed (CRLF) after a given header
field value MUST NOT be logged. Since a bare CRLF sequence is not
permitted within a SIP header field value, mandatory fields MUST NOT
contain a CRLF when logged and consequently no escaping mechanism is
required for it.
Clearly, a SIP parser could not possibly successfully parse a SIP CLF
record in its entirety given the SIP CLF format described in this
document. It is possible to parse individual fields in the SIP CLF
record if they are extracted and given to a SIP parser that would
normally parse those sequence of strings. It should be noted that
any field value that is modified by the escaping mechanisms defined
in this document before logging ('-','?', and CRLF) is likely no
longer well-formed SIP and will fail when given to such a parser.
The intent of logging using SIP CLF is not to faithfully recreate the
bit-exact SIP message being logged. In fact, the formatting rules,
encoding, and character escaping requirements preclude this and may
introduce information loss relative to the original SIP message. A
log reader should never unescape anything in the SIP CLF record since
they are intended to be machine processed using text tools such as
grep and awk. The human user behind the log reader may be required
to infer more semantics about any differences between the original
SIP message and its SIP CLF representation.
<span class="h3"><a class="selflink" id="section-4.4" href="#section-4.4">4.4</a>. Optional Fields</span>
The <OptionalFields> portion of the SIP CLF record is shown below:
0 7 8 15 16 23 24 31
+-----------+-----------+-----------+-----------+
| 0x09 | Tag | 0x40 |\
+-----------+-----------+-----------+-----------+ \
| Vendor-ID | \
+-----------+-----------+-----------+-----------+ \
| Vendor-ID (cont) | \ Repeated
+-----------+-----------+-----------+-----------+ \ as many
| 0x2C | Length (Hex) | > times as
+-----------+-----------+-----------+-----------+ / necessary
| Len (cont)| 0x2C | BEB | 0x2C | /
+-----------+-----------+-----------------------| /
| | /
| Value (variable length) | /
| |/
+-----------+-----------+-----------+-----------+
Figure 5: Optional Fields
<span class="grey">Salgueiro, et al. Standards Track [Page 14]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-15" ></span>
<span class="grey"><a href="./rfc6873">RFC 6873</a> Format for SIP CLF February 2013</span>
Optional fields are those SIP message elements that are not a part of
the mandatory fields list detailed in <a href="./rfc6872#section-8.1">Section 8.1 of [RFC6872]</a>.
After the <MandatoryFields> section, there is an OPTIONAL
<OptionalFields> group (shown in Figure 5) that MAY appear zero or
more times. This <OptionalFields> group provides extensibility to
the SIP CLF. It allows SIP CLF implementers the flexibility to
extend the logging capability of this indexed text representation
beyond just the mandatory log elements described in <a href="./rfc6872#section-8.1">Section 8.1 of
[RFC6872]</a>.
Logging any optional SIP elements MUST be done according to the
format shown in Figure 5. The location of the start of
<OptionalFields> within the SIP CLF record is indicated by the
"Optional Fields Start Pointer" field in <IndexPointers>. After the
initial Tab delimiter byte (0x09) shown in Figure 5, the optional
field being logged is generally represented by the notation:
Tag@Vendor-ID,Length,BEB,Value
The optional field identifier (Tag@Vendor-ID) is composed of a two-
byte Tag and an eight-byte Vendor-ID (both decimal encoded) separated
by an "@" character (0x40). This uniquely identifies the optional
field being logged. The format for this identifier is loosely
modeled after the private use option used by the syslog protocol
[<a href="./rfc5424" title=""The Syslog Protocol"">RFC5424</a>] (Note: this is the second format detailed in <a href="./rfc5424#section-6.3.2">Section 6.3.2
of [RFC5424]</a>). It makes use of the Private Enterprise Number (PEN),
which provides an identifier through a globally unique name space
[<a href="#ref-PEN" title=""Private Enterprise Numbers"">PEN</a>]. This syntax provides the necessary extensibility to SIP CLF
to allow logging of any SIP header, body, as well as any vendor-
specified SIP element.
The Base64 Encoded Byte (BEB) is a boolean that is used to indicate
whether or not the optional element being logged is Base64 encoded.
The Value field for the optional element being logged MUST be Base64
encoded if it has any characters that are 'unprintable'. For the
purposes of this document, we define 'unprintable' to mean a string
of octets that: (a) contains an octet with a value in the range of 0
to 31, inclusive; (b) contains an octet with a value of 127; or (c)
contains any series of octets greater than or equal to 128 that do
not form a valid UTF-8 sequence, as specified by [<a href="#ref-UNICODE" title=""The Unicode Standard, Version 6.2.0"">UNICODE</a>]. If the
optional element being logged is Base64 encoded, then BEB=0x01; if it
is not Base64 encoded, then BEB=0x00.
<span class="grey">Salgueiro, et al. Standards Track [Page 15]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-16" ></span>
<span class="grey"><a href="./rfc6873">RFC 6873</a> Format for SIP CLF February 2013</span>
Optional fields are logged according to the following two syntax
rules:
(1) Vendor-ID = 00000000
A Vendor-ID of zero is used to log the entire SIP message, message
body, Reason-Phrase, or any SIP header fields that are not a part
of the mandatory fields list detailed in <a href="./rfc6872#section-8.1">Section 8.1 of [RFC6872]</a>.
The following Tag values are used to identify which of these
optional elements are being logged:
Tag = 00 - Log SIP Header Field or Reason-Phrase
When logging a SIP Header Field (Tag=00), the associated
"Value" field MUST be populated by the entire header field
being logged. That is, the field-name, the associated colon
(":"), and the field-value. This mechanism provides the
capability to optionally log any SIP header field by
identifying the field being logged within the "Value" field.
Because the Reason-Phrase in a response is part of the Status-
Line and is not identified with a field-name, it is a special
case. In this instance, the associated "Value" field MUST be
populated by the name "Reason-Phrase" followed by a colon (":")
and a single space (SP) between the colon and the logged
Reason-Phrase value.
The corresponding "Length" field includes the length of the
entire "Value" field. This includes the field-name, the colon,
and any linear whitespace (LWS) separator. For Tag=00, the BEB
is set according to whether the SIP Header Field value contains
any 'unprintable' characters. If it does not, the BEB=00; if
it does, the BEB=01. If BEB=01, then only the field-value MUST
be Base64 encoded; the field-name, the associated colon, and
any LWS separator MUST retain their original encoding.
If an optional field occurs more than once in a SIP message
(e.g., Contact, Route, Record-Route, etc.), then each
occurrence MUST be logged with the same Tag value (i.e.,
Tag=00) as a distinct optional field entry in the SIP CLF
record. These repeated optionally logged header fields MUST
preserve the ordinal position of the repeated header fields in
the SIP header. For example, a SIP header containing two Via
header fields with the following ordinal positions within the
SIP header: V1,V2. If optionally logging these header fields,
they would occur as the following entries in the SIP CLF
<span class="grey">Salgueiro, et al. Standards Track [Page 16]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-17" ></span>
<span class="grey"><a href="./rfc6873">RFC 6873</a> Format for SIP CLF February 2013</span>
record. (Note: For the sake of brevity, this example only
shows how these optional header fields would be logged and
omits the remainder of the SIP CLF record):
00@00000000,len_V1,00,Via: V1 00@00000000,len_V2,00,Via: V2
The terminating carriage return line feed (CRLF) after a given
header field value MUST NOT be logged. Since a bare CRLF
sequence is not permitted within a SIP header field value,
optional SIP header fields logged with Tag=00 MUST NOT contain
a CRLF when logged and consequently no escaping mechanism is
required for it.
Tag = 01 - Log message body
SIP message bodies of all types can be optionally logged using
Tag=01. If the message body is logged it MUST adhere to the
maximum size limitation of 4096 bytes for a SIP CLF field, as
detailed in <a href="./rfc6872#section-8">Section 8 of [RFC6872]</a>. Unlike with Tag=00, there
can only be a single entry in the SIP CLF record with Tag=01.
When optionally logging the message body, if the maximum SIP
CLF field size of 4096 bytes is exceeded, the message body
being logged MUST be truncated to meet these size limitations.
When logging a message body (Tag=01), the associated "Value"
field is populated with the Content-Type itself plus the SIP
message body separated with a space. In this manner,
everything about the SIP message body is self-described using a
single tag as compared to enumerating a separate tag for each
body type. Additionally, the corresponding "Length" field
includes the SIP message body, the length of the embedded
Content-Type, and the space separator between the MIME type and
the body content.
For an optionally logged message body (Tag=01), the BEB is set
according to whether the message body contains any
'unprintable' characters. If it does not, the BEB=00; if it
does, the BEB=01. If BEB=01, then the message body that
follows is entirely Base64 encoded except the prepended
Content-Type as described in the previous paragraph.
If an optionally logged SIP message body contains any CRLFs,
they MUST be escaped by using the URI encoded equivalent value
of "%0D%0A". This escaping mechanism applies to all body
types. So we don't make any distinction in treatment between
the various possible body types. If a logged message body has
BEB=01, then it MUST be Base64 encoded prior to any character
escaping. Thus, if a binary body (like an image) is logged, it
<span class="grey">Salgueiro, et al. Standards Track [Page 17]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-18" ></span>
<span class="grey"><a href="./rfc6873">RFC 6873</a> Format for SIP CLF February 2013</span>
will be Base64 encoded first and that Base64 character stream
could never include the CRLF escape sequence of "%0D%0A"
because "%" is not a valid Base64 character.
Tag = 02 - Log entire SIP message
The entire SIP message (i.e., SIP header and message body) can
be optionally logged using a Tag=02. Logging the entire SIP
message MUST conform to the maximum size limitation of 4096
bytes for a SIP CLF field, as detailed in <a href="./rfc6872#section-8">Section 8 of
[RFC6872]</a>. Unlike with Tag=00, there can only be a single
entry in the SIP CLF record with Tag=02. When optionally
logging the entire SIP message if the maximum SIP CLF field
size of 4096 bytes is exceeded the entire SIP message being
logged MUST be truncated to meet these size limitations.
When optionally logging an entire SIP message (Tag=02), the BEB
is set according to whether the message body portion contains
any 'unprintable' characters. If it does not, the BEB=00; if
it does, the BEB=01. If BEB=01, then the entire SIP message is
Base64 encoded (not just the message body). Note that unlike
the case of Tag=01, when logging an entire SIP message (Tag=02)
with 'unprintable' characters (BEB=01), the Content-Type would
not be known prior to decode.
All instances of CRLFs, whether they appear in the SIP headers
or the SIP message body, MUST be escaped by using the URI
encoded equivalent value of "%0D%0A". If a logged SIP message
has BEB=01 then it MUST be Base64 encoded prior to any
character escaping.
(2) Vendor-ID = PEN
A Vendor-ID set to a vendor's own private enterprise number from
the complete current list of private enterprise numbers maintained
by IANA [<a href="#ref-PEN" title=""Private Enterprise Numbers"">PEN</a>] is used to log any other vendor-specified optional
element of a SIP header or body. The value of the Tag is set at
the discretion of the implementer:
Tag = Vendor-specified tag
The definition of the various values of the optional field identifier
(Tag@Vendor-ID) are the basis of how optional elements are logged in
the SIP CLF. For the sake of completeness, the remaining fields in
the format shown in Figure 5 are also defined below:
Length Field (4 bytes): Indicates the length of only the "Value"
field of this optionally logged element (as shown in Figure 5),
<span class="grey">Salgueiro, et al. Standards Track [Page 18]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-19" ></span>
<span class="grey"><a href="./rfc6873">RFC 6873</a> Format for SIP CLF February 2013</span>
hexadecimal encoded. This length corresponds to the length of the
"Value" field only and MUST NOT include any of the other elements
shown in Figure 5.
Base64 Encoded Byte (BEB) Field (1 byte): Indicates whether or not
the subsequent Value Field of the optionally logged element is
Base64 encoded. The Value field for the optional element being
logged MUST be Base64 encoded if it contains any character that is
deemed 'unprintable' according to the definition given previously
in this section. If the optional element being logged is Base64
encoded, then BEB=0x01; if it is not Base64 encoded, then
BEB=0x00.
Value Field (0 to 4096 bytes): Contains the actual value of this
optional field. As with the mandatory fields, UTF-8 Tab
characters (0x09) are replaced with UTF-8 space characters (0x20).
The following are examples of optionally logged SIP elements using
the syntax described in this section. All these examples only show
the <OptionalFields> portion of the SIP CLF record. The mandatory
<IndexPointers> and <MandatoryFields> portions of the SIP CLF are
intentionally omitted for the sake of brevity. Note that all of
these examples of optionally logged fields begin with a leading Tab
delimiter byte (0x09) that is not apparent here.
(1) Contact header field logged as an optional field:
Consider the SIP response:
SIP/2.0 180 Ringing
<allOneLine>
Via: SIP/2.0/UDP host.example.com;
branch=z9hG4bKnashds8;received=192.0.2.1
</allOneLine>
To: Bob <sip:bob@example.com>;tag=a6c85cf
From: Alice <sip:alice@example.com>;tag=1928301774
Call-ID: a84b4c76e66710
Contact: <sip:bob@192.0.2.4>
CSeq: 314159 INVITE
Content-Length: 0
The Contact header field would be logged as an optional field in the
following manner:
00@00000000,001C,00,Contact: <sip:bob@192.0.2.4>
<span class="grey">Salgueiro, et al. Standards Track [Page 19]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-20" ></span>
<span class="grey"><a href="./rfc6873">RFC 6873</a> Format for SIP CLF February 2013</span>
(2) Reason-Phrase logged as an optional field:
For the same SIP response the Reason-Phrase would be logged as
an optional field in the following manner:
00@00000000,0016,00,Reason-Phrase: Ringing
(3) SDP body to be logged as an optional field:
v=0
o=alice 2890844526 2890844526 IN IP4 host.example.com
s=-
c=IN IP4 host.example.com
t=0 0
m=audio 49170 RTP/AVP 0 8 97
This body has a Content-Type of application/sdp and has a length of
123 bytes including all the line-feeds. When logging this body the
"Value" field is composed of the Content-Type and the body separated
by a space, which gives it a combined length of 139 (0x008B) bytes.
This SIP body would be logged as an optional field in the following
manner:
<allOneLine>
01@00000000,008B,00,application/sdp v=0%0D%0Ao=alice 2890844526
2890844526 IN IP4 host.example.com%0D%0As=-%0D%0A
c=IN IP4 host.example.com%0D%0At=0 0%0D%0A
m=audio 49170 RTP/AVP 0 8 97%0D%0A
</allOneLine>
Note that the body is actually logged on a single line and is thus
captured between <allOneLine/> tags. The line-feeds are escaped
using %0D%0A to delimit the various lines in the message body.
(4) binary body to be logged as an optional field:
The second body part of the multipart/mime SIP message shown in
<a href="./rfc4475#section-3.1.1.11">Section 3.1.1.11 of RFC 4475</a> is a binary encoded body
(represented in hex) and if logged would have BEB=01 and would
require Base64 encoding. That binary body would produce six
lines of output after being Base64 encoded. Subsequent escaping
of the CRLF characters would produce an optionally logged body
that would look like the following:
<span class="grey">Salgueiro, et al. Standards Track [Page 20]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-21" ></span>
<span class="grey"><a href="./rfc6873">RFC 6873</a> Format for SIP CLF February 2013</span>
<allOneLine>
01@00000000,0216,01,multipart/mixed;boundary=7a9cbec02ceef655 MI
IBUgYJKoZIhvcNAQcCoIIBQzCCAT8CAQExCTAHBgUrDgMCGjALBgkqhkiG9w0BBw
ExggEgMIIB%0D%0AHAIBATB8MHAxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxp
Zm9ybmlhMREwDwYDVQQHEwhTYW4g%0D%0ASm9zZTEOMAwGA1UEChMFc2lwaXQxKT
AnBgNVBAsTIFNpcGl0IFRlc3QgQ2VydGlmaWNhdGUgQXV0%0D%0AaG9yaXR5AggB
lQBxAjMBEzAHBgUrDgMCGjANBgkqhkiG9w0BAQEFAASBgI70ZvlI8FIt0uWXjp2V
%0D%0Aquny/hWgZllxYpLo2iqo2DUKaM7/rjy9K/8Wdd3VZI5ZPdZHKPJiIPfpQX
SeMw2aFe2r25PRDEIQ%0D%0ALntyidKcwMmuLvvHwM/5Fy87An5PwCfhVG3ktqo6
uz5mzMtd1sZLg4MUnLjm/xgtlE/le2W8mdAF%0D%0A
</allOneLine>
Note that the body is actually logged on a single line and is thus
captured between <allOneLine/> tags. The line-feeds are escaped
using %0D%0A to delimit the various lines in the Base64 encoded
binary body.
(5) Codec information from the SDP body logged as an optional field:
Consider the SIP message:
INVITE sip:bob@example.com SIP/2.0
Via: SIP/2.0/UDP host.example.com;branch=z9hG4bKnashds8
To: Bob <bob@example.com>
From: Alice <alice@example.com>;tag=1928301774
Call-ID: a84b4c76e66710
CSeq: 314159 INVITE
Max-Forwards: 70
Date: Thu, 21 Feb 2002 13:02:03 GMT
Contact: <sip:alice@host.example.com>
Content-Type: application/sdp
Content-Length: 147
v=0
o=UserA 2890844526 2890844526 IN IP4 example.com
s=Session SDP
c=IN IP4 host.example.com
t=0 0
m=audio 49172 RTP/AVP 0
a=rtpmap:0 PCMU/8000
A vendor may choose to log a SIP message element such as the codec
information from the SDP body. This vendor-specified SIP element
would be logged as an optional field in the following manner:
03@00032473,0014,00,a=rtpmap:0 PCMU/8000
<span class="grey">Salgueiro, et al. Standards Track [Page 21]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-22" ></span>
<span class="grey"><a href="./rfc6873">RFC 6873</a> Format for SIP CLF February 2013</span>
(6) N-th message received from a particular peer logged as an
optional field:
Perhaps a vendor wants to log that this message is the n-th
message received from a peering partner. To do so for the SIP
message shown above, the vendor would log this information as:
07@00032473,0016,00,1877 example.com
Which would signify that this is the 1,877th message from the peering
partner example.com. Note that the previous two examples showing an
optionally logged vendor-specified SIP element use a Vendor-ID with a
Private Enterprise Number of 32473. This value has been reserved by
IANA to be used as an example PEN in documentation according to
[<a href="./rfc5612" title=""Enterprise Number for Documentation Use"">RFC5612</a>].
<span class="h2"><a class="selflink" id="section-5" href="#section-5">5</a>. Example SIP CLF Record</span>
The following SIP message is an INVITE request sent by a SIP client:
INVITE sip:192.0.2.10 SIP/2.0
To: <sip:192.0.2.10>
Call-ID: DL70dff590c1-1079051554@example.com
<allOneLine>
From: "Alice" <sip:1001@example.com:5060>;
tag=DL88360fa5fc;epid=0x34619b0
</allOneLine>
CSeq: 1 INVITE
Max-Forwards: 70
Date: Thu, 21 Feb 2012 15:02:03 GMT
<allOneLine>
Via: SIP/2.0/TCP 192.0.2.200:5060;
branch=z9hG4bK-1f6be070c4-DL
</allOneLine>
Contact: "1001" <sip:1001@192.0.2.200:5060>
Content-Type: application/sdp
Content-Length: 418
v=0
o=1001 1456139204 0 IN IP4 192.0.2.200
s=Session SDP
c=IN IP4 192.0.2.200
b=AS:2048
t=0 0
m=audio 13756 RTP/AVP 0 101
a=rtpmap:0 PCMU/8000
<span class="grey">Salgueiro, et al. Standards Track [Page 22]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-23" ></span>
<span class="grey"><a href="./rfc6873">RFC 6873</a> Format for SIP CLF February 2013</span>
Shown below is approximately how this message would appear as a
single record in a SIP CLF logging file if encoded according to the
syntax described in this document. Due to RFC conventions, this log
entry has been split into five lines, instead of the two lines that
actually appear in a log file; and the Tab characters have been
padded out using spaces to simulate their appearance in a text
terminal.
A000100,0053005C005E006D007D008F009E00A000BA00C700EB00F70100
<allOneLine>
1328821153.010 RORUU 1 INVITE - sip:192.0.2.10
192.0.2.10:5060 192.0.2.200:56485 sip:192.0.2.10 -
sip:1001@example.com:5060 DL88360fa5fc
DL70dff590c1-1079051554@example.com S1781761-88 C67651-11
</allOneLine>
A bit-exact version of the actual log entry is provided here, Base64
encoded.
begin-base64 644 clf_record
QTAwMDEwMCwwMDUzMDA1QzAwNUUwMDZEMDA3RDAwOEYwMDlFMDBBMDAwQkEwMEM3MDBF
QjAwRjcwMTAwCjEzMjg4MjExNTMuMDEwCVJPUlVVCTEgSU5WSVRFCS0Jc2lwOjE5Mi4w
LjIuMTAJMTkyLjAuMi4xMDo1MDYwCTE5Mi4wLjIuMjAwOjU2NDg1CXNpcDoxOTIuMC4y
LjEwCS0Jc2lwOjEwMDFAZXhhbXBsZS5jb206NTA2MAlETDg4MzYwZmE1ZmMJREw3MGRm
ZjU5MGMxLTEwNzkwNTE1NTRAZXhhbXBsZS5jb20JUzE3ODE3NjEtODgJQzY3NjUxLTEx
Cg==
====
To recover the unencoded file, the Base64 text above may be passed as
input to the following perl script (the output should be redirected
to a file).
<span class="grey">Salgueiro, et al. Standards Track [Page 23]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-24" ></span>
<span class="grey"><a href="./rfc6873">RFC 6873</a> Format for SIP CLF February 2013</span>
<CODE BEGINS>
#!/usr/bin/perl
use strict;
my $bdata = "";
use MIME::Base64;
while(<>)
{
if (/begin-base64 644 clf_record/ .. /-- ==== --/)
{
if ( m/^\s*[^\s]+\s*$/)
{
$bdata = $bdata . $_;
}
}
}
print decode_base64($bdata);
<CODE ENDS>
<span class="h2"><a class="selflink" id="section-6" href="#section-6">6</a>. Text Tool Considerations</span>
This format has been designed to allow text tools to easily process
logs without needing to understand the indexing format. Index lines
may be rapidly discarded by checking the first character of the line:
index lines will always start with an alphabetical character, while
field lines will start with a numerical character.
Within a field line, script tools can quickly split fields at the Tab
characters. The first 12 fields are positional, and the meaning of
any subsequent fields can be determined by checking the first four
characters of the field. Alternately, these non-positional fields
can be located using a regular expression. For example, the "Contact
value" in a request can be found by searching for the perl regex
/\t0000,....,([^\t]*)/.
<span class="h2"><a class="selflink" id="section-7" href="#section-7">7</a>. Security Considerations</span>
This document does not introduce any new security considerations
beyond those discussed in [<a href="./rfc6872" title=""The Common Log Format (CLF) for the Session Initiation Protocol (SIP): Framework and Information Model"">RFC6872</a>].
In the interest of protecting the sensitive information contained in
a SIP CLF file, [<a href="./rfc6872" title=""The Common Log Format (CLF) for the Session Initiation Protocol (SIP): Framework and Information Model"">RFC6872</a>] notes that values might need to be
obfuscated for privacy reasons when SIP CLF files are exchanged
between domains. If a Base64 encoded string contains the non-
obfuscated value, then that would also need to be obfuscated before
Base64 encoding.
<span class="grey">Salgueiro, et al. Standards Track [Page 24]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-25" ></span>
<span class="grey"><a href="./rfc6873">RFC 6873</a> Format for SIP CLF February 2013</span>
<span class="h2"><a class="selflink" id="section-8" href="#section-8">8</a>. Operational Guidance</span>
SIP CLF log files will take up a substantive amount of disk space
depending on traffic volume at a processing entity and the amount of
information being logged. As such, any enterprise using SIP CLF
should establish operational procedures for file rollovers as
appropriate to the needs of the organization.
Listing such operational guidelines in this document is out of scope
for this work.
<span class="h2"><a class="selflink" id="section-9" href="#section-9">9</a>. IANA Considerations</span>
This specification establishes a new "Session Initiation Protocol
(SIP) Common Log Format (CLF) Parameters" registry, which contains
two new sub-registries: "SIP CLF Version Values" and "SIP CLF
Transport Flag Values". Initial entries are defined by this
specification for both sub-registries. Addition of any new sub-
registry to the "Session Initiation Protocol (SIP) Common Log Format
(CLF) Parameters" registry is to be done using the IETF Review
registration policy detailed in [<a href="./rfc5226" title="">RFC5226</a>].
<span class="h3"><a class="selflink" id="section-9.1" href="#section-9.1">9.1</a>. SIP CLF Version</span>
This document defines the SIP CLF "Version" field in <a href="#section-4.1">Section 4.1</a>.
IANA has created a registry of Version values entitled "SIP CLF
Version Values". Version numbers MUST be incremented for any new SIP
CLF protocol specification that changes any part of the SIP CLF
record format. Changes include addition or removal of fields or a
change of syntax or semantics of existing fields.
Version numbers must be registered via the Standards Action method
described in [<a href="./rfc5226" title="">RFC5226</a>]. IANA has registered the Versions shown in
Table 1 below.
+------------+----------------------+-----------+
| Version | FORMAT | Reference |
+------------+----------------------+-----------+
| 0x41 ('A') | Defined in [<a href="./rfc6873">RFC6873</a>] | [<a href="./rfc6873">RFC6873</a>] |
+------------+----------------------+-----------+
Table 1: IANA-Registered SIP CLF Version Values
<span class="grey">Salgueiro, et al. Standards Track [Page 25]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-26" ></span>
<span class="grey"><a href="./rfc6873">RFC 6873</a> Format for SIP CLF February 2013</span>
<span class="h3"><a class="selflink" id="section-9.2" href="#section-9.2">9.2</a>. SIP CLF Transport Flag</span>
This document defines the SIP CLF "Transport Flag" as fourth byte in
the Flags field of the SIP CLF record. The format and values of the
Transport Flag are described in <a href="#section-4.2">Section 4.2</a>. IANA has created a
registry of SIP CLF Transport Flag values titled "SIP CLF Transport
Flag Values".
SIP CLF Transport Flag values must be registered via the IETF Review
method described in [<a href="./rfc5226" title="">RFC5226</a>]. IANA has registered the Transport
Flag values shown in Table 2 below.
+-------+--------------------+-----------+
| Value | Transport Protocol | Reference |
+-------+--------------------+-----------+
| U | UDP | [<a href="./rfc6873">RFC6873</a>] |
| T | TCP | [<a href="./rfc6873">RFC6873</a>] |
| S | SCTP | [<a href="./rfc6873">RFC6873</a>] |
+-------+--------------------+-----------+
Table 2: IANA-Registered SIP CLF Transport Flag
<span class="h2"><a class="selflink" id="section-10" href="#section-10">10</a>. Acknowledgments</span>
The authors of this document would like to acknowledge and thank
Peter Musgrave (the chair of the SIPCLF working group) and Robert
Sparks (the assigned Area Director) for their support, guidance, and
continued invaluable feedback.
This work benefited from the discussions and invaluable input by the
various members of the SIPCLF working group. These include Brian
Trammell, Eric Burger, Cullen Jennings, Benoit Claise, Saverio
Niccolini, and Dan Burnett. Special thanks to Hadriel Kaplan, Chris
Lonvick, Paul E. Jones, John Elwell, Claudio Allocchio, and Joe
Clarke for their constructive comments, suggestions, and reviews that
were critical to the formulation and refinement of this document.
Thanks to Anders Nygren for his early implementation, insight, and
reviews of the SIP CLF format.
<span class="grey">Salgueiro, et al. Standards Track [Page 26]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-27" ></span>
<span class="grey"><a href="./rfc6873">RFC 6873</a> Format for SIP CLF February 2013</span>
<span class="h2"><a class="selflink" id="section-11" href="#section-11">11</a>. References</span>
<span class="h3"><a class="selflink" id="section-11.1" href="#section-11.1">11.1</a>. Normative References</span>
[<a id="ref-RFC2119">RFC2119</a>] Bradner, S., "Key words for use in RFCs to Indicate
Requirement Levels", <a href="https://www.rfc-editor.org/bcp/bcp14">BCP 14</a>, <a href="./rfc2119">RFC 2119</a>, March 1997.
[<a id="ref-RFC3261">RFC3261</a>] Rosenberg, J., Schulzrinne, H., Camarillo, G., Johnston,
A., Peterson, J., Sparks, R., Handley, M., and E.
Schooler, "SIP: Session Initiation Protocol", <a href="./rfc3261">RFC 3261</a>,
June 2002.
[<a id="ref-RFC6872">RFC6872</a>] Gurbani, V., Burger, E., Anjali, T., Abdelnur, H., and O.
Festor, "The Common Log Format (CLF) for the Session
Initiation Protocol (SIP): Framework and Information
Model", <a href="./rfc6872">RFC 6872</a>, February 2013.
<span class="h3"><a class="selflink" id="section-11.2" href="#section-11.2">11.2</a>. Informative References</span>
[<a id="ref-PEN">PEN</a>] IANA, "Private Enterprise Numbers", 2009,
<<a href="http://www.iana.org/assignments/enterprise-numbers">http://www.iana.org/assignments/enterprise-numbers</a>>.
[<a id="ref-RFC1166">RFC1166</a>] Kirkpatrick, S., Stahl, M., and M. Recker, "Internet
numbers", <a href="./rfc1166">RFC 1166</a>, July 1990.
[<a id="ref-RFC4475">RFC4475</a>] Sparks, R., Hawrylyshen, A., Johnston, A., Rosenberg, J.,
and H. Schulzrinne, "Session Initiation Protocol (SIP)
Torture Test Messages", <a href="./rfc4475">RFC 4475</a>, May 2006.
[<a id="ref-RFC5226">RFC5226</a>] Narten, T. and H. Alvestrand, "Guidelines for Writing an
IANA Considerations Section in RFCs", <a href="https://www.rfc-editor.org/bcp/bcp26">BCP 26</a>, <a href="./rfc5226">RFC 5226</a>,
May 2008.
[<a id="ref-RFC5424">RFC5424</a>] Gerhards, R., "The Syslog Protocol", <a href="./rfc5424">RFC 5424</a>, March 2009.
[<a id="ref-RFC5612">RFC5612</a>] Eronen, P. and D. Harrington, "Enterprise Number for
Documentation Use", <a href="./rfc5612">RFC 5612</a>, August 2009.
[<a id="ref-RFC5737">RFC5737</a>] Arkko, J., Cotton, M., and L. Vegoda, "IPv4 Address Blocks
Reserved for Documentation", <a href="./rfc5737">RFC 5737</a>, January 2010.
[<a id="ref-RFC5952">RFC5952</a>] Kawamura, S. and M. Kawashima, "A Recommendation for IPv6
Address Text Representation", <a href="./rfc5952">RFC 5952</a>, August 2010.
[<a id="ref-UNICODE">UNICODE</a>] The Unicode Consortium, "The Unicode Standard, Version
6.2.0", (Mountain View, CA: ISBN 978-1-936213-07-8), 2012,
<<a href="http://www.unicode.org/versions/Unicode6.2.0/">http://www.unicode.org/versions/Unicode6.2.0/</a>>.
<span class="grey">Salgueiro, et al. Standards Track [Page 27]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-28" ></span>
<span class="grey"><a href="./rfc6873">RFC 6873</a> Format for SIP CLF February 2013</span>
Authors' Addresses
Gonzalo Salgueiro
Cisco Systems
7200-12 Kit Creek Road
Research Triangle Park, NC 27709
US
EMail: gsalguei@cisco.com
Vijay Gurbani
Bell Labs, Alcatel-Lucent
1960 Lucent Lane
Rm 9C-533
Naperville, IL 60563
US
EMail: vkg@bell-labs.com
Adam Roach
Mozilla
Dallas, TX
US
EMail: adam@nostrum.com
Salgueiro, et al. Standards Track [Page 28]
</pre>
|