Log Extraction API¶
Retrieve and export Silo audit logs. Supports 26 log types, pagination, date filtering, and CSV/JSON export. Requires LOG_TOKEN.
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
|
Example
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
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 | |
__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
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 | |
extract_logs ¶
extract_logs(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 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]
|
List of log type strings 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
|
If True, include logs from sub-organizations. Omitted from the request when not provided. |
None
|
Note
Wire format parameter mappings:
- Python
log_types(list) → wire"type"(comma-joined string) - 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 metadata including: |
dict[str, Any]
|
|
dict[str, Any]
|
|
dict[str, Any]
|
|
dict[str, Any]
|
|
dict[str, Any]
|
|
dict[str, Any]
|
|
Raises:
| Type | Description |
|---|---|
LogExtractionAPIError
|
If the API request fails. A
|
ValidationError
|
If parameters are invalid or log types are unsupported |
Example
Extract recent logs with comma-joined type list¶
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
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 | |
extract_all_logs ¶
extract_all_logs(org: str, start_seq: int, log_types: list[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]
|
List of log types to collect |
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) |
None
|
end_date
|
int | datetime | None
|
Optional date filter (int days-ago or datetime) |
None
|
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 |
Example
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
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 | |
get_log_sequence_info ¶
Get information about available log sequences for an organization.
Probes the log sequence range by fetching the earliest available log
entry 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 available log.
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 |
Example
seq_info = api.get_log_sequence_info("my_company") print(f"Earliest log 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
get_valid_log_types
classmethod
¶
Get a list of all valid log types supported by the platform.
Returns:
| Type | Description |
|---|---|
list[str]
|
Sorted list of valid log type strings |
Example
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
|
List of log type strings to validate |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if all log types are valid, False otherwise |
Example
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], 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 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]
|
List of log types to collect |
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) |
None
|
end_date
|
int | datetime | None
|
Optional date filter (int days-ago or datetime) |
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 |
Example
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
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 | |
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". |
Example
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
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]
|
class: |
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]
|
class: |
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 |
Example
parse_egress_hierarchy( ... "World / / North America / / United States / / New York, NY" ... ) {'world': 'World', 'region': 'North America', 'country': 'United States', 'city': 'New York, NY'}
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 :data: |
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. |