subsys-dfx-hisysevent-tool.md 7.4 KB
Newer Older
D
duangavin123 已提交
1 2 3 4
# HiSysEvent Tool Usage<a name="EN-US_TOPIC_0000001231614021"></a>

## Overview<a name="section1886702718521"></a>

S
shawn_he 已提交
5 6 7 8 9 10 11 12 13
The HiSysEvent tool is a command line tool preconfigured in the **/system/bin** directory of the system. You can use this tool to subscribe to real-time system events or query historical system vents.

## Subscribing to Real-Time System Events<a name="section1210623418527"></a>

-   Command for subscribing to real-time system events:

    ```
    hisysevent -r
    ```
D
duangavin123 已提交
14

S
shawn_he 已提交
15
    Description of command options:
D
duangavin123 已提交
16

S
shawn_he 已提交
17 18 19
    | Option| Description|
    | -------- | --------- |
    | -r&nbsp;        | Subscribes to real-time system events based on the default settings. When this option is specified, any real-time system event will be printed on the console.|
D
duangavin123 已提交
20

S
shawn_he 已提交
21
-   Command for enabling the debugging mode:
D
duangavin123 已提交
22 23

    ```
S
shawn_he 已提交
24
    hisysevent -r -d
D
duangavin123 已提交
25 26
    ```

S
shawn_he 已提交
27 28 29 30 31 32 33
    Description of command options:

    | Option| Description|
    | -------- | --------- |
    | -d       | Subscribes to real-time system events in debugging mode.|

-   Command for subscribing to real-time system events by event tag:
D
duangavin123 已提交
34 35

    ```
36
    hisysevent -r -t <tag> [-c [WHOLE_WORD|PREFIX|REGULAR]]
S
shawn_he 已提交
37 38 39 40 41 42 43 44 45
    ```

    Description of command options:

    | Option| Description|
    | -------- | --------- |
    | -t&nbsp;        | Event tag used to filter subscribed real-time system events.|
    | -c&nbsp;        | Matching rule for event tags. The options can be **WHOLE_WORD**, **PREFIX**, or **REGULAR**.|

S
shawn_he 已提交
46
    Example:
47 48 49

    ```
    # hisysevent -r -t "TAG" -c PREFIX
S
shawn_he 已提交
50
    {"domain_":"ARKUI","name_":"UI_BLOCK_6S","type_":1,"time_":1501940269812,"tz_":"+0000","tag_":"TAG1","pid_":1428,"tid_":1452,"uid_":10001,"level_":"CRITICAL","info_":""}
51 52
    # hisysevent -r -t "TA\w{0,1}" -c REGULAR
    {"domain_":"WINDOWMANAGER","name_":"NO_FOCUS_WINDOW","type_":1,"time_":1501940269802,"tz_":"+0000","tag_":"TAG","pid_":1428,"tid_":1433,"uid_":10001,"level_":"CRITICAL","info_":""}
S
shawn_he 已提交
53
    {"domain_":"ARKUI","name_":"UI_BLOCK_6S","type_":1,"time_":1501940269812,"tz_":"+0000","tag_":"TAG1","pid_":1428,"tid_":1452,"uid_":10001,"level_":"CRITICAL","info_":""}
54 55
    # hisysevent -r -t "TA\w+" -c REGULAR
    {"domain_":"WINDOWMANAGER","name_":"NO_FOCUS_WINDOW","type_":1,"time_":1501940269802,"tz_":"+0000","tag_":"TAG","pid_":1428,"tid_":1433,"uid_":10001,"level_":"CRITICAL","info_":""}
S
shawn_he 已提交
56
    {"domain_":"ARKUI","name_":"UI_BLOCK_6S","type_":1,"time_":1501940269812,"tz_":"+0000","tag_":"TAG1","pid_":1428,"tid_":1452,"uid_":10001,"level_":"CRITICAL","info_":""}
57 58
    ```

S
shawn_he 已提交
59 60 61 62 63 64
-   Command for subscribing to real-time system events by event domain and event name:

    ```
    hisysevent -r -o <domain> -n <eventName> [-c [WHOLE_WORD|PREFIX|REGULAR]]
    ```

65 66
    Description of command options:

S
shawn_he 已提交
67 68 69 70 71 72
    | Option| Description|
    | -------- | --------- |
    | -o       | Event domain used to filter subscribed real-time system events.|
    | -n       | Event name used to filter subscribed real-time system events.|
    | -c       | Matching rule for event domains and event names. The options can be **WHOLE_WORD**, **PREFIX**, or **REGULAR**.|

S
shawn_he 已提交
73
    Example:
74 75 76 77 78 79 80 81 82 83 84 85 86

    ```
    # hisysevent -r -o "DOMAINA" -n "EVENTNAMEA"
    {"domain_":"DOMAINA","name_":"EVENTNAMEA","type_":1,"time_":1501940269802,"tz_":"+0000","pid_":1428,"tid_":1333,"uid_":10002,"level_":"CRITICAL","info_":""}
    # hisysevent -r -o "DOMA\w{0,10}" -n "EVENT\w+" -c REULAR
    {"domain_":"DOMAINA","name_":"EVENTNAMEA","type_":1,"time_":1501940269802,"tz_":"+0000","pid_":1428,"tid_":1333,"uid_":10002,"level_":"CRITICAL","info_":""}
    {"domain_":"DOMAINABC","name_":"EVENTNAMEABC","type_":1,"time_":1501940269938,"tz_":"+0000","pid_":1428,"tid_":1336,"uid_":10002,"level_":"CRITICAL","info_":""}
    # hisysevent -r -o "DOMA\w{0,10}" -c REGULAR
    {"domain_":"DOMAINA","name_":"EVENTNAMEA","type_":1,"time_":1501940269802,"tz_":"+0000","pid_":1428,"tid_":1333,"uid_":10002,"level_":"CRITICAL","info_":""}
    {"domain_":"DOMAINABC","name_":"EVENTNAMEABC","type_":1,"time_":1501940269938,"tz_":"+0000","pid_":1428,"tid_":1336,"uid_":10002,"level_":"CRITICAL","info_":""}
    {"domain_":"DOMAINABC","name_":"EVENTNAMEB","type_":1,"time_":1501940279938,"tz_":"+0000","pid_":1428,"tid_":1344,"uid_":10002,"level_":"CRITICAL","info_":""}
    ```

S
shawn_he 已提交
87 88 89 90 91 92 93 94 95
    >![](../public_sys-resources/icon-note.gif) **NOTE:**
    >If **-t**, **-o**, and **-n** are specified, the system checks whether the configured event tag is null. If the event tag is not null, the system filters system events based on the matching rules for the event tag. Otherwise, the system filters system events based on the matching rules for the event domain and event name.

## Querying Historical System Events<a name="section1210623418539"></a>

-   Command for querying historical system events:

    ```
    hisysevent -l
D
duangavin123 已提交
96 97
    ```

S
shawn_he 已提交
98
    Description of command options:
D
duangavin123 已提交
99

S
shawn_he 已提交
100 101 102 103 104
    | Option| Description|
    | -------- | --------- |
    | -l       | Queries historical system events based on the default settings. A maximum of 1,000 latest system events will be returned.|

-   Command for querying historical system events within the specified period of time:
D
duangavin123 已提交
105 106

    ```
S
shawn_he 已提交
107
    hisysevent -l -s <begin time> -e <end time>
D
duangavin123 已提交
108 109
    ```

S
shawn_he 已提交
110 111 112 113 114 115
    Description of command options:

    | Option| Description|
    | -------- | --------- |
    | -s       | Start time for querying historical system events. Only system events generated after the start time are returned.|
    | -e       | End time for querying historical system events. Only system events generated before the end time are returned.|
D
duangavin123 已提交
116

S
shawn_he 已提交
117
    Example:
118 119 120 121 122 123 124 125 126

    ```
    # hisysevent -l -s 20207388633 -e 20207389000
    {"domain_":"DOMAINA","name_":"EVENTNAMEA","type_":1,"time_":20207388633,"tz_":"+0000","pid_":1428,"tid_":1333,"uid_":10002,"level_":"CRITICAL","info_":""}
    {"domain_":"DOMAINA","name_":"EVENTNAMEA","type_":1,"time_":20207388634,"tz_":"+0000","pid_":1428,"tid_":1333,"uid_":10002,"level_":"CRITICAL","info_":""}
    {"domain_":"DOMAINA","name_":"EVENTNAMEA","type_":1,"time_":20207388900,"tz_":"+0000","pid_":1428,"tid_":1333,"uid_":10002,"level_":"CRITICAL","info_":""}
    {"domain_":"DOMAINA","name_":"EVENTNAMEA","type_":1,"time_":20207389000,"tz_":"+0000","pid_":1428,"tid_":1333,"uid_":10002,"level_":"CRITICAL","info_":""}
    ```

S
shawn_he 已提交
127 128 129 130 131
-   Command for setting the maximum number of historical events that can be queried:

    ```
    hisysevent -l -m <max hisysevent count>
    ```
D
duangavin123 已提交
132

S
shawn_he 已提交
133
    Description of command options:
D
duangavin123 已提交
134

S
shawn_he 已提交
135 136 137
    | Option| Description|
    | -------- | --------- |
    | -m       | Maximum number of historical system events that can be queried. The value ranges from **0** to **1000**. The number of returned system events is not more than the value of this parameter.|
138

S
shawn_he 已提交
139
    Example:
140 141 142 143 144 145 146 147 148 149 150

    ```
    # hisysevent -l -s 20207388633 -e 20207389000 -m 3
    {"domain_":"DOMAINA","name_":"EVENTNAMEA","type_":1,"time_":20207388634,"tz_":"+0000","pid_":1428,"tid_":1333,"uid_":10002,"level_":"CRITICAL","info_":""}
    {"domain_":"DOMAINA","name_":"EVENTNAMEA","type_":1,"time_":20207388900,"tz_":"+0000","pid_":1428,"tid_":1333,"uid_":10002,"level_":"CRITICAL","info_":""}
    {"domain_":"DOMAINA","name_":"EVENTNAMEA","type_":1,"time_":20207389000,"tz_":"+0000","pid_":1428,"tid_":1333,"uid_":10002,"level_":"CRITICAL","info_":""}
    # hisysevent -l -m 2
    {"domain_":"DOMAINA","name_":"EVENTNAMEA","type_":1,"time_":20207388633,"tz_":"+0000","pid_":1428,"tid_":1333,"uid_":10002,"level_":"CRITICAL","info_":""}
    {"domain_":"DOMAINA","name_":"EVENTNAMEA","type_":1,"time_":20207388634,"tz_":"+0000","pid_":1428,"tid_":1333,"uid_":10002,"level_":"CRITICAL","info_":""}
    ```