使用Splunk识别相对不寻常的分类事件

时间:2018-02-07 06:06:46

标签: splunk splunk-query splunk-calculation

我开始使用Splunk并尝试解决问题。我有一个包含数百万条日志记录的数据集。用例是识别特定角色不常见的事件,并突出显示事件和用户。下表给出了数据的快照。任务是附加最后两列,并为每个角色标识发生的附加事件相对低于同一角色中的其他附加事件。

 user_name  role         event_name     event_type
    A1     Provider     Open Session    Patient
    A1     Provider     Open Session    Patient
    A1     Provider     View Session    Patient
    B1     Provider     Search Session  Admin
    B1     Provider     Search Session  Admin
    B1     Provider     Search Session  Patient
    B1     Provider     Search Session  Admin
    B1     Provider     Open Session    Admin
    C1     Physician    Open Session    Patient
    C1     Physician    Modify Session  Patient
    C1     Physician    Modify Session  Patient
    C2     Physician    Open Session    Patient
    C2     Physician    Open Session    Patient
    C3     Physician    Modify Session  Admin

如果我想为角色“提供者”找到异常事件,则输出应为

    user_name    role        appended_event     
        A1     Provider     View Session Patient    
        B1     Provider     Search Session Patient
        B1     Provider     Open Session Admin

同样,如果我想找到“Physician”角色的异常事件,输出应为

    user_name    role        appended_event     
        C3     Physician        Modify Session Admin    

我也在寻找一种可视化这种报告的方法。 对此的任何帮助都会很棒

1 个答案:

答案 0 :(得分:2)

您可以从此开始,然后定义自己的阈值:

| eventstats count as role_event_count by role appended_event
| eventstats count as role_count by role 
| eval pct = role_event_count / role_count * 100