Skip to content

Conversation

@fukusuket
Copy link
Collaborator

@fukusuket fukusuket commented Nov 30, 2025

What Changed

Evidence

Integration-Test

I’d appreciate it if you could check it when you have time🙏

@fukusuket fukusuket requested a review from Copilot November 30, 2025 11:00
@fukusuket fukusuket self-assigned this Nov 30, 2025
@fukusuket fukusuket added the enhancement New feature or request label Nov 30, 2025
@fukusuket fukusuket added this to the v2.0.0 milestone Nov 30, 2025
@fukusuket
Copy link
Collaborator Author

fukusuket commented Nov 30, 2025

Test rule

title: TEST
id: 7d9680d7-60d9-4a65-9884-20549fa1cb0d
status: test
description: 
references:
author: Yamato
date: 2025-11-30
logsource:
    product: azure
    service: activitylogs
detection:
    selection:
        operationName.value|contains: publicIPAddresses/delete
    condition: selection
falsepositives:
level: informational

Test log(Microsoft Extractor Suite Log format)

[
    {
        "authorization":  {
                              "action":  "Microsoft.Resources/subscriptions/resourceGroups/delete",
                              "scope":  "/subscriptions/5d22beda-5051-4d08-89eb-a56f372e8890/resourceGroups/wela"
                          },
        "caller":  "[email protected]",
        "channels":  "Operation",
        "claims":  {
                       "aud":  "https://management.core.windows.net/",
                       "iss":  "https://sts.windows.net/fe5e9374-1f2c-4128-a5e2-033efa641646/",
                       "iat":  "1764466056",
                       "nbf":  "1764466056",
                       "exp":  "1764470656",
                       "http://schemas.microsoft.com/claims/authnclassreference":  "1",
                       "acrs":  "p1",
                       "aio":  "AfQAC/8aAAAAf1JwLyT3LYiw5AuvrrllwxPYIJcWAanrzZDn8o51q3rQKz9QlW+QlwIZ3etwkBP+TSTZ7Vj89JC8eQbeckLTn1vwbbA6rzTIFq7i0KZED9XW7khhvUOudmVoYLKIeJZ+7Rv8FcY6Zf91a5bdEWS7secTsIVo8RTfpoSzBKWFkBeQpu8wGDxRq49XAXSCXRAcB1TIjcoq4eLAVJQjW+kxGrMe0x74MSOZjUOtkR+kZkE1jI8s3s+8yeaMlI/32nxS8dmOKzPwM7rlFnT52Sf6aaNTHDNw3IPuxOAemtYylH7mOvdmfcdjnlBEeTJ2lzT7",
                       "altsecid":  "1:live.com:00037FFE1A7CA7BC",
                       "http://schemas.microsoft.com/claims/authnmethodsreferences":  "pwd,mfa",
                       "appid":  "c44b4083-3bb0-49c1-b47d-974e53cbdf3c",
                       "appidacr":  "0",
                       "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress":  "[email protected]",
                       "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname":  "大和",
                       "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname":  "朱雀",
                       "groups":  "66c84c0c-6c25-470b-9330-5113abab1ecf",
                       "http://schemas.microsoft.com/identity/claims/identityprovider":  "live.com",
                       "idtyp":  "user",
                       "ipaddr":  "240d:1a:7fe:a000:e4f5:37e6:6cfd:adbd",
                       "name":  "大和朱雀",
                       "http://schemas.microsoft.com/identity/claims/objectidentifier":  "97ac2078-7b11-4982-9b43-5e6f407d066c",
                       "puid":  "1003200047D500B0",
                       "rh":  "1.AVUAdJNe_iwfKEGl4gM--mQWRkZIf3kAutdPukPawfj2MBO_AKxVAA.",
                       "http://schemas.microsoft.com/identity/claims/scope":  "user_impersonation",
                       "sid":  "00a94039-740c-0a35-217e-b7906bee94c6",
                       "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier":  "CHDqallWk9cFDPMYuPhZ2NJd95t1QR4QUzkOAuO6HS4",
                       "http://schemas.microsoft.com/identity/claims/tenantid":  "fe5e9374-1f2c-4128-a5e2-033efa641646",
                       "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name":  "live.com#[email protected]",
                       "uti":  "BYMvvd9bGkqlm0tPNk_GAA",
                       "ver":  "1.0",
                       "wids":  "62e90394-69f5-4237-9190-012177145e10",
                       "xms_act_fct":  "5 3",
                       "xms_edov":  "true",
                       "xms_ftd":  "ro9HGrmLNinwnU5EUm47yT6L3YfvJimHTBw85VKMbXkBa29yZWFzb3V0aC1kc21z",
                       "xms_idrel":  "1 24",
                       "xms_sub_fct":  "3 4",
                       "xms_tcdt":  "1558360955"
                   },
        "correlationId":  "af67db90-ea0f-4ff5-8da7-6570de228eb2",
        "description":  "",
        "eventDataId":  "5df3b668-cc09-44fe-906c-e54bf315911b",
        "eventName":  {
                          "value":  "EndRequest",
                          "localizedValue":  "End request"
                      },
        "category":  {
                         "value":  "Administrative",
                         "localizedValue":  "Administrative"
                     },
        "id":  "/subscriptions/5d22beda-5051-4d08-89eb-a56f372e8890/resourcegroups/wela/providers/Microsoft.Network/publicIPAddresses/sakurai10-ip/events/5df3b668-cc09-44fe-906c-e54bf315911b/ticks/639000639064650448",
        "level":  "Informational",
        "resourceGroupName":  "wela",
        "resourceProviderName":  {
                                     "value":  "Microsoft.Network",
                                     "localizedValue":  "Microsoft.Network"
                                 },
        "resourceId":  "/subscriptions/5d22beda-5051-4d08-89eb-a56f372e8890/resourcegroups/wela/providers/Microsoft.Network/publicIPAddresses/sakurai10-ip",
        "resourceType":  {
                             "value":  "Microsoft.Resources/subscriptions/resourceGroups",
                             "localizedValue":  "Microsoft.Resources/subscriptions/resourceGroups"
                         },
        "operationId":  "90f4018b-2d97-43cb-878e-d7932b08026d",
        "operationName":  {
                              "value":  "Microsoft.Network/publicIPAddresses/delete",
                              "localizedValue":  "Delete Public Ip Address"
                          },
        "properties":  {
                           "eventCategory":  "Administrative",
                           "entity":  "/subscriptions/5d22beda-5051-4d08-89eb-a56f372e8890/resourcegroups/wela/providers/Microsoft.Network/publicIPAddresses/sakurai10-ip",
                           "message":  "Microsoft.Network/publicIPAddresses/delete",
                           "hierarchy":  "fe5e9374-1f2c-4128-a5e2-033efa641646/5d22beda-5051-4d08-89eb-a56f372e8890"
                       },
        "status":  {
                       "value":  "Succeeded",
                       "localizedValue":  "Succeeded"
                   },
        "subStatus":  {
                          "value":  "",
                          "localizedValue":  ""
                      },
        "eventTimestamp":  "2025-11-30T01:45:06.4650448Z",
        "submissionTimestamp":  "2025-11-30T01:47:13Z",
        "subscriptionId":  "5d22beda-5051-4d08-89eb-a56f372e8890",
        "tenantId":  "fe5e9374-1f2c-4128-a5e2-033efa641646"
    },
    {
        "authorization":  {
                              "action":  "Microsoft.Resources/subscriptions/resourceGroups/delete",
                              "scope":  "/subscriptions/5d22beda-5051-4d08-89eb-a56f372e8890/resourceGroups/wela"
                          },
        "caller":  "[email protected]",
        "channels":  "Operation",
        "claims":  {
                       "aud":  "https://management.core.windows.net/",
                       "iss":  "https://sts.windows.net/fe5e9374-1f2c-4128-a5e2-033efa641646/",
                       "iat":  "1764466056",
                       "nbf":  "1764466056",
                       "exp":  "1764470656",
                       "http://schemas.microsoft.com/claims/authnclassreference":  "1",
                       "acrs":  "p1",
                       "aio":  "AfQAC/8aAAAAf1JwLyT3LYiw5AuvrrllwxPYIJcWAanrzZDn8o51q3rQKz9QlW+QlwIZ3etwkBP+TSTZ7Vj89JC8eQbeckLTn1vwbbA6rzTIFq7i0KZED9XW7khhvUOudmVoYLKIeJZ+7Rv8FcY6Zf91a5bdEWS7secTsIVo8RTfpoSzBKWFkBeQpu8wGDxRq49XAXSCXRAcB1TIjcoq4eLAVJQjW+kxGrMe0x74MSOZjUOtkR+kZkE1jI8s3s+8yeaMlI/32nxS8dmOKzPwM7rlFnT52Sf6aaNTHDNw3IPuxOAemtYylH7mOvdmfcdjnlBEeTJ2lzT7",
                       "altsecid":  "1:live.com:00037FFE1A7CA7BC",
                       "http://schemas.microsoft.com/claims/authnmethodsreferences":  "pwd,mfa",
                       "appid":  "c44b4083-3bb0-49c1-b47d-974e53cbdf3c",
                       "appidacr":  "0",
                       "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress":  "[email protected]",
                       "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname":  "大和",
                       "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname":  "朱雀",
                       "groups":  "66c84c0c-6c25-470b-9330-5113abab1ecf",
                       "http://schemas.microsoft.com/identity/claims/identityprovider":  "live.com",
                       "idtyp":  "user",
                       "ipaddr":  "240d:1a:7fe:a000:e4f5:37e6:6cfd:adbd",
                       "name":  "大和朱雀",
                       "http://schemas.microsoft.com/identity/claims/objectidentifier":  "97ac2078-7b11-4982-9b43-5e6f407d066c",
                       "puid":  "1003200047D500B0",
                       "rh":  "1.AVUAdJNe_iwfKEGl4gM--mQWRkZIf3kAutdPukPawfj2MBO_AKxVAA.",
                       "http://schemas.microsoft.com/identity/claims/scope":  "user_impersonation",
                       "sid":  "00a94039-740c-0a35-217e-b7906bee94c6",
                       "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier":  "CHDqallWk9cFDPMYuPhZ2NJd95t1QR4QUzkOAuO6HS4",
                       "http://schemas.microsoft.com/identity/claims/tenantid":  "fe5e9374-1f2c-4128-a5e2-033efa641646",
                       "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name":  "live.com#[email protected]",
                       "uti":  "BYMvvd9bGkqlm0tPNk_GAA",
                       "ver":  "1.0",
                       "wids":  "62e90394-69f5-4237-9190-012177145e10",
                       "xms_act_fct":  "5 3",
                       "xms_edov":  "true",
                       "xms_ftd":  "ro9HGrmLNinwnU5EUm47yT6L3YfvJimHTBw85VKMbXkBa29yZWFzb3V0aC1kc21z",
                       "xms_idrel":  "1 24",
                       "xms_sub_fct":  "3 4",
                       "xms_tcdt":  "1558360955"
                   },
        "correlationId":  "af67db90-ea0f-4ff5-8da7-6570de228eb2",
        "description":  "",
        "eventDataId":  "8a2bfc79-5cfa-4150-a2fc-1279ac34b94a",
        "eventName":  {
                          "value":  "EndRequest",
                          "localizedValue":  "End request"
                      },
        "category":  {
                         "value":  "Administrative",
                         "localizedValue":  "Administrative"
                     },
        "id":  "/subscriptions/5d22beda-5051-4d08-89eb-a56f372e8890/resourcegroups/wela/providers/Microsoft.Network/virtualNetworks/vnet-japaneast/events/8a2bfc79-5cfa-4150-a2fc-1279ac34b94a/ticks/639000639016595788",
        "level":  "Informational",
        "resourceGroupName":  "wela",
        "resourceProviderName":  {
                                     "value":  "Microsoft.Network",
                                     "localizedValue":  "Microsoft.Network"
                                 },
        "resourceId":  "/subscriptions/5d22beda-5051-4d08-89eb-a56f372e8890/resourcegroups/wela/providers/Microsoft.Network/virtualNetworks/vnet-japaneast",
        "resourceType":  {
                             "value":  "Microsoft.Resources/subscriptions/resourceGroups",
                             "localizedValue":  "Microsoft.Resources/subscriptions/resourceGroups"
                         },
        "operationId":  "ae920602-ccb3-4ee3-acac-517413d6c1bc",
        "operationName":  {
                              "value":  "Microsoft.Network/virtualNetworks/delete",
                              "localizedValue":  "Delete Virtual Network"
                          },
        "properties":  {
                           "eventCategory":  "Administrative",
                           "entity":  "/subscriptions/5d22beda-5051-4d08-89eb-a56f372e8890/resourcegroups/wela/providers/Microsoft.Network/virtualNetworks/vnet-japaneast",
                           "message":  "Microsoft.Network/virtualNetworks/delete",
                           "hierarchy":  "fe5e9374-1f2c-4128-a5e2-033efa641646/5d22beda-5051-4d08-89eb-a56f372e8890"
                       },
        "status":  {
                       "value":  "Succeeded",
                       "localizedValue":  "Succeeded"
                   },
        "subStatus":  {
                          "value":  "",
                          "localizedValue":  ""
                      },
        "eventTimestamp":  "2025-11-30T01:45:01.6595788Z",
        "submissionTimestamp":  "2025-11-30T01:47:02Z",
        "subscriptionId":  "5d22beda-5051-4d08-89eb-a56f372e8890",
        "tenantId":  "fe5e9374-1f2c-4128-a5e2-033efa641646"
    }
]

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for Microsoft Graph API JSON format for Azure logs. The Graph API uses a different JSON structure than traditional Azure logs, with events wrapped in a { "value": [...] } object and using different field names (e.g., eventTimestamp instead of time, nested fields like category.value instead of flat category).

Key Changes:

  • Added multi-key field support using pipe-separated field names to handle different Azure log formats
  • Enhanced JSON parsing to support Graph API format with value array wrapper
  • Added BOM handling for JSON files with UTF-8 BOM markers
  • Removed unused krapslog dependency

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
src/option/timefiler.rs Added multi-key timestamp field support and test cases for different timestamp formats
src/core/timeline_writer.rs Enhanced field extraction to support pipe-separated field names and updated default timestamp key
src/core/scan.rs Added Graph API JSON format parsing with value wrapper and BOM handling
src/core/log_source.rs Extended service matching to check both nested and flat category fields
config/azure_profile.yaml Updated field mappings to support both Graph API and traditional formats
Cargo.toml, Cargo.lock Removed unused krapslog dependency

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@fukusuket
Copy link
Collaborator Author

fukusuke@fukusukenoMacBook-Air suzaku-2.0.0-mac-aarch64 % ./suzaku azure-timeline -f Azure-ActivityLog.json -r test.yml -o timeline.csv -C -q
Start time: 2025/11/30 20:12
Version: 2.0.0-dev (Dev Build)

Total detection rules: 1
Total correlation rules: 0

Rule Authors:
╭────────────╮
│ Yamato (1) │
╰────────────╯

Results Summary:
Events with hits / Total events: 14 / 1,080 (Data reduction: 1,066 events (98.70%))
Total | Unique critical detections: 0 (0%) | 0 (0%)
Total | Unique high detections: 0 (0%) | 0 (0%)
Total | Unique medium detections: 0 (0%) | 0 (0%)
Total | Unique low detections: 0 (0%) | 0 (0%)
Total | Unique informational detections: 14 (100%) | 1 (7%)


Dates with most total detections:
critical: n/a, high: n/a, medium: n/a, low: n/a, informational: n/a
╭──────────────────────────────────────────────╮
│ Top critical alerts:        Top high alerts: │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ n/a                         n/a              │
│ n/a                         n/a              │
│ n/a                         n/a              │
│ n/a                         n/a              │
│ n/a                         n/a              │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ Top medium alerts:          Top low alerts:  │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ n/a                         n/a              │
│ n/a                         n/a              │
│ n/a                         n/a              │
│ n/a                         n/a              │
│ n/a                         n/a              │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ Top informational alerts:                    │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ TEST (14)                                    │
│ n/a                                          │
│ n/a                                          │
│ n/a                                          │
│ n/a                                          │
╰───────────────────────────╌──────────────────╯

Results saved: timeline.csv (6.9 KiB)
Elapsed time: 00:00:00
% head timeline.csv
Timestamp,RuleTitle,RuleAuthor,Level,Category,OperationName,Entity,Caller,SrcIP,ResourceId,CorrelationId,RuleID
2025-11-30 01:45:06.4650448,TEST,Yamato,informational,Administrative,Microsoft.Network/publicIPAddresses/delete,/subscriptions/5d22beda-5051-4d08-89eb-a56f372e8890/resourcegroups/wela/providers/Microsoft.Network/publicIPAddresses/sakurai10-ip,[email protected],240d:1a:7fe:a000:e4f5:37e6:6cfd:adbd,/subscriptions/5d22beda-5051-4d08-89eb-a56f372e8890/resourcegroups/wela/providers/Microsoft.Network/publicIPAddresses/sakurai10-ip,af67db90-ea0f-4ff5-8da7-6570de228eb2,7d9680d7-60d9-4a65-9884-20549fa1cb0d
2025-11-30 01:35:03.5968368,TEST,Yamato,informational,Administrative,Microsoft.Network/publicIPAddresses/delete,/subscriptions/5d22beda-5051-4d08-89eb-a56f372e8890/resourcegroups/wela/providers/Microsoft.Network/publicIPAddresses/sakurai10-ip,[email protected],240d:1a:7fe:a000:e4f5:37e6:6cfd:adbd,/subscriptions/5d22beda-5051-4d08-89eb-a56f372e8890/resourcegroups/wela/providers/Microsoft.Network/publicIPAddresses/sakurai10-ip,af67db90-ea0f-4ff5-8da7-6570de228eb2,7d9680d7-60d9-4a65-9884-20549fa1cb0d
2025-11-16 07:22:25.8238156,TEST,Yamato,informational,Administrative,Microsoft.Network/publicIPAddresses/delete,/subscriptions/5d22beda-5051-4d08-89eb-a56f372e8890/resourcegroups/wela/providers/Microsoft.Network/publicIPAddresses/samurai2022-ip,[email protected],240d:1a:7fe:a000:b5bf:823d:8dd1:23a6,/subscriptions/5d22beda-5051-4d08-89eb-a56f372e8890/resourcegroups/wela/providers/Microsoft.Network/publicIPAddresses/samurai2022-ip,c80caeba-7636-41c7-b29c-a1fdda79ebce,7d9680d7-60d9-4a65-9884-20549fa1cb0d

@fukusuket fukusuket marked this pull request as ready for review November 30, 2025 11:13
Copy link
Contributor

@YamatoSecurity YamatoSecurity left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fukusuket LGTM! Thanks so much!!

@YamatoSecurity YamatoSecurity merged commit 35ab40f into main Dec 1, 2025
4 checks passed
@fukusuket fukusuket deleted the 113-graph-api-support branch December 1, 2025 10:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support Microsoft Graph API JSON Format

3 participants