Log Extraction API¶
Retrieve and export Silo audit logs. Supports 26 log types, pagination, date filtering, and CSV/JSON export. Requires LOG_TOKEN.
For what each log type records and what its fields mean, see the Silo Logs Reference Guide on the Authentic8 support portal.
Bases: BaseAPIClient
API client for Silo log extraction operations.
This class provides methods for extracting audit logs and activity data from the Authentic8 Silo platform for compliance, monitoring, and analysis purposes.
The log extraction API allows you to: - Extract logs by type and sequence range - Retrieve comprehensive audit trails - Handle large log datasets with pagination - Filter logs by organization and time periods - Export logs for external analysis and compliance
Supported log types include: - ADMIN_AUDIT: Administrative actions and changes - AUTH: Authentication and authorization events - COOKIES: Cookie handling and management - DOWNLOAD: File download activities - UPLOAD: File upload activities - POST_DATA: Form submissions and POST requests - SESSION: Session lifecycle events - ENC: Encryption and security events - URL: URL access and navigation - BLOCKED_URL: Blocked URL attempts - LOCATION_CHANGE: Geographic location changes - TRANSLATION: Content translation events - A8SS: Silo storage system events - EXPLOIT: Exploit detection events - PRINT: Print operations - SMS: SMS-related events - ISOLATE_BYPASS: Isolation bypass events - TRAFFICMAN: Traffic management events - HARVEST: Harvesting operation logs - CASE_MANAGER: Case management events - CLIPBOARD: Clipboard operations - LAUNCHER: Launcher events - EXTENSION: Browser extension events - APP_LAUNCH: Application launch events - EVENT: Generic platform events - NEXUS: Nexus AI conversation events
Attributes:
| Name | Type | Description |
|---|---|---|
VALID_LOG_TYPES |
set[str]
|
Set of 26 valid log type strings.
All types have canonical schemas defined in
|
MAX_ENC_BATCH_SIZE |
int
|
Maximum batch size (30) for ENC log type extraction to prevent payload size issues with encrypted log entries. |
EXTRACT_LOCK_TTL |
int
|
Default request timeout (600s) for this client,
matching the backend's per-extract lock TTL. Overridable with the
|
Examples:
>>> from silo_sdk import LogExtractionAPI, load_config
>>> config = load_config()
>>> logs = LogExtractionAPI(config)
>>>
>>> # Extract recent authentication logs
>>> auth_logs = logs.extract_logs(
... org="my_organization",
... start_seq=1000,
... log_types=["AUTH", "SESSION"],
... limit=500
... )
>>>
>>> # Extract all logs with pagination
>>> all_logs = logs.extract_all_logs(
... org="my_organization",
... start_seq=1,
... log_types=["ADMIN_AUDIT", "AUTH"]
... )
Source code in silo_sdk/logging/extraction_api.py
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 | |
__init__ ¶
Initialize the log extraction API client.
This client takes its request timeout from LOG_EXTRACT_TIMEOUT
(A8_LOG_EXTRACT_TIMEOUT), which defaults to 600 seconds -- the
server's per-extract lock TTL -- rather than from the SDK-wide
REQUEST_TIMEOUT default of 30 seconds. Extracts routinely run for
minutes, and a client that gives up while the lock is still held
blocks its own retries until that TTL expires.
The 600-second default only ever raises the extraction timeout; it
never lowers one already set higher. A REQUEST_TIMEOUT above 600
is kept as-is, so anyone who raised it to work around the previous
30-second limit is not cut back on upgrade. An explicit
LOG_EXTRACT_TIMEOUT wins outright, including a value below
REQUEST_TIMEOUT, because that is a deliberate choice rather than
an inherited default.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
dict[str, Any]
|
Configuration dictionary containing API settings |
required |
Raises:
| Type | Description |
|---|---|
ConfigurationError
|
If required configuration is missing, or if
|
Source code in silo_sdk/logging/extraction_api.py
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 | |
extract_logs ¶
extract_logs(org: str, start_seq: int, log_types: list[str] | str, end_seq: int | None = None, limit: int | None = None, start_date: int | datetime | None = None, end_date: int | datetime | None = None, include_suborgs: bool | None = None) -> dict[str, Any]
Extract logs for the specified organization.
Retrieves logs from the Silo platform for the specified organization within the given sequence range and log types. This method supports pagination for handling large datasets.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
org
|
str
|
Organization name to extract logs from (API org name, not vanity URL). |
required |
start_seq
|
int
|
Log sequence number from which to start extraction (must be >= 0). |
required |
log_types
|
list[str] | str
|
Log types from |
required |
end_seq
|
int | None
|
Optional log sequence number at which to stop extraction (must be >= start_seq). |
None
|
limit
|
int | None
|
Optional number of logs to return (max 1000 per request).
If extracting ENC logs, the limit is automatically capped at
|
None
|
start_date
|
int | datetime | None
|
Optional date filter. If an int, interpreted as "days
ago from today" and converted to an epoch timestamp. If a
datetime, converted directly to epoch. Sent as |
None
|
end_date
|
int | datetime | None
|
Optional date filter. Same format rules as start_date.
Sent as |
None
|
include_suborgs
|
bool | None
|
Whether to include logs from sub-organizations.
Omitted from the request when not provided, and the backend
default is True: omitting it returns sub-org rows, the
same as |
None
|
Note
start_date does not narrow results today. Narrow by
end_date (without end_seq) or filter the returned rows
by create_ts until a fix ships.
Wire format parameter mappings:
- Python
log_types(list, or a string naming one type) → wire"type"(JSON array — a comma-joined string is rejected by the platform as an unknown log type, so the SDK refuses it too) - Python
start_date/end_date(int or datetime) → wire"start_time"/"end_time"(epoch int) - Log extraction uses
"org"(not"org_name") in the wire format - Four log types use spaces on the wire but underscores
in the SDK:
BLOCKED_URL→BLOCKED URL,CASE_MANAGER→CASE MANAGER,LOCATION_CHANGE→LOCATION CHANGE,POST_DATA→POST DATA. The conversion is automatic.
Wire format structure::
{
"command": "extractlog",
"org": "my_company", # ← uses "org", not "org_name"
"start_seq": 1000,
"type": ["AUTH", "SESSION", "BLOCKED URL"], # ← spaces on wire
"start_time": 1704067200, # ← start_date → start_time (epoch)
"end_time": 1707753600, # ← end_date → end_time (epoch)
"limit": 500
}
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Dictionary containing extracted logs and pagination state: |
dict[str, Any]
|
|
dict[str, Any]
|
|
dict[str, Any]
|
|
dict[str, Any]
|
Those three fields, and nothing else. ** |
dict[str, Any]
|
and |
dict[str, Any]
|
reading one raised |
dict[str, Any]
|
pages, and |
Raises:
| Type | Description |
|---|---|
LogExtractionAPIError
|
If the API request fails. A
|
ValidationError
|
If parameters are invalid or log types are unsupported |
Examples:
>>> # Extract recent logs for several types at once
>>> result = api.extract_logs(
... org="my_company",
... start_seq=1000,
... log_types=["AUTH", "SESSION", "ADMIN_AUDIT"],
... limit=500
... )
>>> print(f"Retrieved {len(result['logs'])} logs")
>>> if result['is_more']:
... print(f"More logs available starting at seq {result['next_seq']}")
>>>
>>> # Date-based filtering (start_date as int = days ago)
>>> result = api.extract_logs(
... org="my_company",
... start_seq=0,
... log_types=["AUTH"],
... start_date=7, # ← 7 days ago
... limit=1000
... )
Source code in silo_sdk/logging/extraction_api.py
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 | |
extract_all_logs ¶
extract_all_logs(org: str, start_seq: int, log_types: list[str] | str, end_seq: int | None = None, batch_size: int = 1000, max_logs: int | None = None, start_date: int | datetime | None = None, end_date: int | datetime | None = None) -> list[dict[str, Any]]
Extract all logs for the specified organization with automatic pagination.
Retrieves all available logs matching the criteria by automatically handling pagination. This method is useful for comprehensive log extraction and analysis.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
org
|
str
|
Organization name to extract logs from |
required |
start_seq
|
int
|
Log sequence number from which to start extraction |
required |
log_types
|
list[str] | str
|
Log types to collect — a list, or a string naming
exactly one such as |
required |
end_seq
|
int | None
|
Optional log sequence number at which to stop extraction |
None
|
batch_size
|
int
|
Number of logs to request in each API call (max 1000) |
1000
|
max_logs
|
int | None
|
Optional maximum total number of logs to retrieve |
None
|
start_date
|
int | datetime | None
|
Optional date filter (int days-ago or datetime).
Currently has no effect: the backend ignores
|
None
|
end_date
|
int | datetime | None
|
Optional date filter (int days-ago or datetime).
Ignored by the backend when |
None
|
Note
Sub-organization logs are included: this method does not send
include_suborgs, and the backend default is True. To narrow
by date, use end_date or filter rows by create_ts.
Returns:
| Type | Description |
|---|---|
list[dict[str, Any]]
|
List of all log entries matching the criteria |
Raises:
| Type | Description |
|---|---|
LogExtractionAPIError
|
If the API request fails |
ValidationError
|
If parameters are invalid |
Examples:
>>> all_logs = api.extract_all_logs(
... org="my_company",
... start_seq=1,
... log_types=["AUTH", "ADMIN_AUDIT"],
... batch_size=500,
... max_logs=10000
... )
>>> print(f"Retrieved {len(all_logs)} total logs")
Source code in silo_sdk/logging/extraction_api.py
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 | |
extract_logs_per_type ¶
extract_logs_per_type(org: str, start_seq: int, log_types: list[str], end_seq: int | None = None, limit: int | None = None, start_date: int | datetime | None = None, end_date: int | datetime | None = None, include_suborgs: bool | None = None) -> dict[str, Any]
Extract each log type in its own request and merge the pages.
Use this when a combined :meth:extract_logs call fails because one
type is unavailable -- most often ENC on an org without encryption,
which may fail the whole request while every other type would
succeed (needs re-verification: the server's ENC rejection is
known to fire only for a bare-string type "ENC" with
start_seq 0, and the SDK sends lists). Types that fail are
reported in type_errors instead of failing the call.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
org
|
str
|
Organization name (API org name, not vanity URL). |
required |
start_seq
|
int
|
Log sequence number to start every type from. |
required |
log_types
|
list[str]
|
Log types to request, one request each. |
required |
end_seq
|
int | None
|
Optional ending sequence number. |
None
|
limit
|
int | None
|
Optional per-type limit (max 1000 per request). |
None
|
start_date
|
int | datetime | None
|
Optional date filter (int days-ago or datetime).
Currently has no effect (see :meth: |
None
|
end_date
|
int | datetime | None
|
Optional date filter (int days-ago or datetime).
Ignored by the backend when |
None
|
include_suborgs
|
bool | None
|
Whether to include sub-organization logs. Omitted when not provided; the backend default is True. |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Dictionary with: |
dict[str, Any]
|
|
dict[str, Any]
|
|
dict[str, Any]
|
|
dict[str, Any]
|
|
dict[str, Any]
|
Resuming from the lowest |
dict[str, Any]
|
skipped; the next page may repeat rows of types that were further |
dict[str, Any]
|
ahead, so deduplicate by |
dict[str, Any]
|
|
dict[str, Any]
|
|
dict[str, Any]
|
Types in |
dict[str, Any]
|
Re-request them from the original |
Raises:
| Type | Description |
|---|---|
ValidationError
|
If |
LogExtractionAPIError
|
If every type fails (the first type's error is re-raised) |
Source code in silo_sdk/logging/extraction_api.py
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 | |
get_log_sequence_info ¶
Get information about available log sequences for an organization.
Probes the log sequence range by fetching the earliest AUTH row
(sub-organizations included) via extractlog. The ext API does not expose a dedicated
sequence-info command, so this method derives what it can from a
minimal extraction call.
Note
max_seq and total_logs are not available from the ext
API and are always returned as None. Use is_more to check
whether logs exist beyond the first entry, and next_seq to
begin paginating from the earliest AUTH row.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
org
|
str
|
Organization name (API org name, not vanity URL). |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Dictionary containing: |
dict[str, Any]
|
|
dict[str, Any]
|
|
dict[str, Any]
|
|
dict[str, Any]
|
|
dict[str, Any]
|
|
dict[str, Any]
|
|
Raises:
| Type | Description |
|---|---|
LogExtractionAPIError
|
If the probe extraction fails |
ValidationError
|
If org is invalid |
Examples:
>>> seq_info = api.get_log_sequence_info("my_company")
>>> print(f"Earliest AUTH row at seq: {seq_info['min_seq']}")
>>> print(f"More logs available: {seq_info['is_more']}")
>>> # max_seq and total_logs are None — not available via ext API
Source code in silo_sdk/logging/extraction_api.py
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 | |
get_log_types ¶
Fetch the log types the deployed platform supports.
This is the authoritative source. :meth:get_valid_log_types returns
a list compiled into the SDK, which goes stale as the platform adds
types; this asks the server.
Log type names are returned in SDK form (underscores), so they can be
passed straight to :meth:extract_logs. On the wire four of them use
spaces — BLOCKED URL, CASE MANAGER, LOCATION CHANGE and
POST DATA — and are translated here.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
version
|
int | str | None
|
A |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
dict[str, Any]
|
The server's result with |
|
typically |
dict[str, Any]
|
|
dict[str, Any]
|
|
|
dict[str, Any]
|
|
|
dict[str, Any]
|
When the supplied |
|
dict[str, Any]
|
|
|
dict[str, Any]
|
Any other keys the server returns are passed through unchanged. |
Raises:
| Type | Description |
|---|---|
LogExtractionAPIError
|
If the request fails or returns an unexpected shape. |
Warning
version is not currently a reliable cache key. Two deployments
exposing different numbers of log types have been observed
reporting the same version, so a client that skips the fetch
on an unchanged version can miss a newly added type. Prefer
calling without version until that is fixed upstream.
Examples:
>>> api = LogExtractionAPI(config)
>>> info = api.get_log_types()
>>> info["version"]
'20260817'
>>> "NEXUS" in info["log_types"]
True
Feed the result straight back into an extraction:
Source code in silo_sdk/logging/extraction_api.py
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 | |
get_valid_log_types
classmethod
¶
Get the list of log types compiled into the SDK.
This list is static and can fall behind the platform. Prefer
:meth:get_log_types, which asks the server; use this one offline, or
as a fallback when the call fails.
Returns:
| Type | Description |
|---|---|
list[str]
|
Sorted list of valid log type strings |
Examples:
>>> valid_types = LogExtractionAPI.get_valid_log_types()
>>> print("Supported log types:")
>>> for log_type in valid_types:
... print(f" - {log_type}")
Source code in silo_sdk/logging/extraction_api.py
validate_log_types
classmethod
¶
Validate that all provided log types are supported.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
log_types
|
Any
|
Log types to validate — a list, or a string naming
exactly one such as |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if all log types are valid, False otherwise |
Examples:
>>> types_to_check = ["AUTH", "SESSION", "INVALID_TYPE"]
>>> if not LogExtractionAPI.validate_log_types(types_to_check):
... print("Some log types are invalid")
Source code in silo_sdk/logging/extraction_api.py
export_logs_to_file ¶
export_logs_to_file(org: str, start_seq: int, log_types: list[str] | str, output_file: str, format_type: str = 'json', end_seq: int | None = None, batch_size: int = 1000, start_date: int | datetime | None = None, end_date: int | datetime | None = None) -> dict[str, Any]
Export logs to a file in the specified format.
Extracts all matching logs and exports them to a file for external analysis, compliance reporting, or archival purposes.
Note
CSV export of a single log type uses that type's schema column order and appends any keys present in the rows but absent from the schema, so unknown fields are not dropped. Sub-organization logs are included (the backend default).
CSV export escapes formula-injection risk: any field value
starting with =, +, -, @, tab, or carriage
return (e.g. a URL or clipboard value crafted as
=HYPERLINK(...)) is written with a leading single quote
so spreadsheet applications (Excel, Google Sheets) treat it
as literal text instead of evaluating it as a formula. JSON
and text export are unaffected.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
org
|
str
|
Organization name to extract logs from |
required |
start_seq
|
int
|
Log sequence number from which to start extraction |
required |
log_types
|
list[str] | str
|
Log types to collect — a list, or a string naming
exactly one such as |
required |
output_file
|
str
|
Path to the output file |
required |
format_type
|
str
|
Export format ("json", "csv", or "txt") |
'json'
|
end_seq
|
int | None
|
Optional log sequence number at which to stop extraction |
None
|
batch_size
|
int
|
Number of logs to process in each batch |
1000
|
start_date
|
int | datetime | None
|
Optional date filter (int days-ago or datetime).
Currently has no effect: the backend ignores
|
None
|
end_date
|
int | datetime | None
|
Optional date filter (int days-ago or datetime).
Ignored by the backend when |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Dictionary containing export statistics including: |
dict[str, Any]
|
|
dict[str, Any]
|
|
dict[str, Any]
|
|
dict[str, Any]
|
|
Raises:
| Type | Description |
|---|---|
LogExtractionAPIError
|
If export fails |
ValidationError
|
If parameters are invalid |
Examples:
>>> export_result = api.export_logs_to_file(
... org="my_company",
... start_seq=1,
... log_types=["AUTH", "ADMIN_AUDIT"],
... output_file="/path/to/audit_logs.json",
... format_type="json"
... )
>>> print(f"Exported {export_result['total_logs']} logs")
Source code in silo_sdk/logging/extraction_api.py
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 | |
group_logs_by_type ¶
Group a flat list of log entries by their type field.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
logs
|
list[dict[str, Any]]
|
List of log entry dictionaries |
required |
Returns:
| Type | Description |
|---|---|
dict[str, list[dict[str, Any]]]
|
Dictionary mapping log type name to list of entries for that type. |
dict[str, list[dict[str, Any]]]
|
Entries without a type field are grouped under "UNKNOWN". |
Examples:
>>> logs = [
... {"type": "AUTH", "user": "alice"},
... {"type": "SESSION", "session_id": "s1"},
... {"type": "AUTH", "user": "bob"},
... {"no_type_field": "value"}
... ]
>>> grouped = api.group_logs_by_type(logs)
>>> len(grouped["AUTH"])
2
>>> len(grouped["UNKNOWN"])
1
Source code in silo_sdk/logging/extraction_api.py
Merging Per-Type Pages¶
merge_per_type_extracts() is the merge step behind extract_logs_per_type(), for callers who make the single-type extract_logs() requests themselves. It is importable directly from silo_sdk.logging.
silo_sdk.logging.extraction_api.merge_per_type_extracts ¶
merge_per_type_extracts(results: dict[str, dict[str, Any]], start_seq: int, type_errors: dict[str, str] | None = None) -> dict[str, Any]
Merge single-type extractlog pages into one page that resumes safely.
Each type paginates independently, so types stop at different sequence
numbers. Resuming from the highest next_seq skips every row a lagging
type has not sent yet, silently. The merged next_seq is therefore the
lowest among the types still reporting is_more; the next page may
repeat rows of the types that were further ahead, so deduplicate by
seq_id. With no type reporting more, it is the lowest next_seq any
type reported, so a poller still advances; it falls back to start_seq
only when no type reported one.
Types listed in type_errors contributed nothing, so next_seq does
not cover them and is_more says nothing about them. Re-request those
types from the original start_seq; resuming them from the merged
next_seq would skip their rows.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
results
|
dict[str, dict[str, Any]]
|
Per-type |
required |
start_seq
|
int
|
The |
required |
type_errors
|
dict[str, str] | None
|
Error strings for types that failed, keyed by log type. |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Dictionary with: |
dict[str, Any]
|
|
dict[str, Any]
|
|
dict[str, Any]
|
|
dict[str, Any]
|
|
Log Parsing Utilities¶
silo_sdk.logging.log_utils provides helpers for working with extracted log data — parsing JSON-encoded fields, building frequency tables, parsing LAUNCHER egress hierarchy strings, and flattening nested structures for CSV export. These functions are importable directly from silo_sdk.logging.
Utilities for parsing and transforming Silo platform log data.
Provides helpers for:
- Parsing JSON-encoded string fields (
headers,response_headers) - Extracting frequency tables (User-Agent, Content-Type)
- Parsing LAUNCHER
egress_regionhierarchy strings - Normalizing wire-format log type names to SDK names
- Flattening nested dicts and JSON fields for CSV export
parse_json_field ¶
Parse a JSON-encoded string field into a dict.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
log_entry
|
dict[str, Any]
|
Log entry dictionary. |
required |
field
|
str
|
Field name to parse. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Any] | None
|
Parsed dict, or |
dict[str, Any] | None
|
or not valid JSON. |
parse_all_json_fields ¶
Parse all known JSON-encoded fields in a log entry.
Replaces headers and response_headers string values with
their parsed dict equivalents. Fields that fail to parse are left
unchanged.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
log_entry
|
dict[str, Any]
|
Log entry dictionary. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
New dictionary with parsed JSON fields. The original is not |
dict[str, Any]
|
modified. |
extract_user_agents ¶
Extract User-Agent frequency table from log entries.
Parses headers (JSON string or dict) and counts the
User-Agent value across all entries.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
logs
|
list[dict[str, Any]]
|
List of log entry dicts (typically URL or ISOLATE_BYPASS). |
required |
Returns:
| Type | Description |
|---|---|
Counter[str]
|
|
extract_content_types ¶
Extract Content-Type frequency from response headers.
Parses response_headers and counts the Content-Type value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
logs
|
list[dict[str, Any]]
|
List of log entry dicts (typically URL). |
required |
Returns:
| Type | Description |
|---|---|
Counter[str]
|
|
parse_egress_hierarchy ¶
Parse a LAUNCHER egress_region hierarchy string into components.
The LAUNCHER log type returns egress_region as a slash-separated
hierarchy path like::
World / / North America / / United States / / New York, NY
This function splits it into named components.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
egress_region
|
str
|
Raw hierarchy string from LAUNCHER logs. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, str | None]
|
Dictionary with keys |
dict[str, str | None]
|
Missing levels are |
Examples:
normalize_log_type ¶
Convert wire-format type field to SDK name.
The backend returns BLOCKED URL, CASE MANAGER,
LOCATION CHANGE, and POST DATA with spaces. This function
converts those to the SDK's underscore convention.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
log_entry
|
dict[str, Any]
|
Log entry dictionary. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
New dictionary with normalized |
dict[str, Any]
|
is not modified. |
normalize_log_types ¶
Normalize type fields across a list of log entries.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
logs
|
list[dict[str, Any]]
|
List of log entry dicts. |
required |
Returns:
| Type | Description |
|---|---|
list[dict[str, Any]]
|
New list with normalized |
expand_json_fields ¶
Expand JSON-encoded string fields into dot-notation columns.
For example, a headers field containing
'{"User-Agent": "Mozilla/5.0"}' becomes
{"headers.User-Agent": "Mozilla/5.0"}.
The original JSON string field is removed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
log_entry
|
dict[str, Any]
|
Log entry dictionary. |
required |
fields
|
list[str] | None
|
Fields to expand. Defaults to |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
New dictionary with expanded fields. |
flatten_nested_dicts ¶
Flatten nested dict fields using dot notation.
For fields that are already dicts (not JSON strings), this flattens them into top-level keys. For example::
{"egress_info": {"protocol": "direct", "connectivity": "datacenter"}}
becomes::
{"egress_info.protocol": "direct", "egress_info.connectivity": "datacenter"}
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
log_entry
|
dict[str, Any]
|
Log entry dictionary. |
required |
fields
|
list[str] | None
|
Specific fields to flatten. If |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
New dictionary with flattened fields. |