Skip to content

Event Analytics – Using Endpoints

Getting Top Events

The Event Analytics Service outputs the most frequent events with their number of occurrences. It receives the entire dataset as input, performs sorting based on the number of occurrences and returns a sorted list of events with the associated count.

Endpoint:

1
POST /findTopEvents

Content-Type: application/json

Request example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
{
    "numberOfTopPositionsRequired": 2,
    "eventsMetadata": {
        "eventTextPropertyName": "string"
    },
    "events": [
        {
            "_time": "2017-11-21T12:23:07.961Z",
            "string": "a",
            "string_qc": 0
        },
        {
            "_time": "2017-11-21T12:23:08.961Z",
            "string": "x",
            "string_qc": 0
        },
        {
            "_time": "2017-11-21T12:23:08.961Z",
            "string": "b",
            "string_qc": 0
        },
        {
            "_time": "2017-11-21T12:23:08.961Z",
            "string": "h",
            "string_qc": 0
        },
        {
            "_time": "2017-11-21T12:23:09.961Z",
            "string": "b",
            "string_qc": 0
        },
        {
            "_time": "2017-11-21T12:24:00.961Z",
            "string": "b",
            "string_qc": 0
        },
        {
            "_time": "2017-11-21T12:25:03.961Z",
            "string": "b",
            "string_qc": 0
        },
        {
            "_time": "2017-11-21T12:30:02.961Z",
            "string": "k",
            "string_qc": 0
        },
        {
            "_time": "2017-11-21T12:33:08.961Z",
            "string": "l",
            "string_qc": 0
        },
        {
            "_time": "2017-11-21T12:33:09.961Z",
            "string": "b",
            "string_qc": 0
        },
        {
            "_time": "2017-11-21T12:34:08.961Z",
            "string": "b",
            "string_qc": 0
        },
        {
            "_time": "2017-11-21T12:35:09.961Z",
            "string": "b",
            "string_qc": 0
        },
        {
            "_time": "2017-11-21T12:36:00.961Z",
            "string": "p",
            "string_qc": 0
        },
        {
            "_time": "2017-11-21T12:37:03.961Z",
            "string": "p",
            "string_qc": 0
        },
        {
            "_time": "2017-11-21T12:38:28.961Z",
            "string": "q",
            "string_qc": 0
        }
    ]
}

Response example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
[
    {
        "appearances": 7,
        "string": "b"
    },
    {
        "appearances": 2,
        "string": "p"
    }
]

Counting Events in a Time Range

Receives as input a list of events and a splitInterval property in eventsMetadata (value in milliseconds). The output contains the time range and the number of event occurrences in that specific time range.

Endpoint:

1
POST /countEvents

Content-Type: application/json

Request example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
{
  "eventsMetadata": {
    "eventTextPropertyName": "text",
    "splitInterval": 5000
 },
  "events": [
    {
      "_time": "2017-10-01T12:00:00.001Z",
      "text": "INTRODUCING FUEL",
      "text_qc": 0
 },
    {
      "_time": "2017-10-01T12:00:00.023Z",
      "text": "INTRODUCING FUEL",
      "text_qc": 0
 },
    {
      "_time": "2017-10-01T12:00:01.001Z",
      "text": "Status@Flame On",
      "text_qc": 0
 },
    {
      "_time": "2017-10-01T12:00:02.001Z",
      "text": "Status@Flame Off",
      "text_qc": 0
 },
    {
      "_time": "2017-10-01T12:00:03.001Z",
      "text": "Error code: 340",
      "text_qc": 0
 },
    {
      "_time": "2017-10-01T12:00:04.001Z",
      "text": "Error code: 340",
      "text_qc": 0
 },
    {
      "_time": "2017-10-01T12:00:04.002Z",
      "text": "Error code: 340",
      "text_qc": 0
 },
    {
      "_time": "2017-10-01T12:00:05.001Z",
      "text": "INTRODUCING FUEL",
      "text_qc": 0
 },
    {
      "_time": "2017-10-01T12:00:08.001Z",
      "text": "Status@Flame On",
      "text_qc": 0
 },
    {
      "_time": "2017-10-01T12:00:09.001Z",
      "text": "Status@Flame Off",
      "text_qc": 0
 }
  ]
}

Response example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
{
  "output": [{
    "startTime": "2017-10-01T12:00:00.001Z",
    "endTime": "2017-10-01T12:00:05Z",
    "eventCount": 7
  },
  {
    "startTime": "2017-10-01T12:00:05.001Z",
    "endTime": "2017-10-01T12:00:10Z",
    "eventCount": 3
  }]
}

Filtering Events

Receives as input a list of events and an ignore list (filterList). The output contains those events from the received event list that are not part of the ignore list.

Endpoint:

1
POST /filterEvents

Content-Type: application/json

Request example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
{
  "eventsMetadata": {
    "eventTextPropertyName": "text"
  },
  "events": [
    {
      "_time": "2017-10-01T12:00:00.001Z",
      "text": "INTRODUCING FUEL",
      "text_qc": 0
    },
    {
      "_time": "2017-10-01T12:00:01.001Z",
      "text": "Status@Flame On",
      "text_qc": 0
    },
    {
      "_time": "2017-10-01T12:00:02.001Z",
      "text": "Status@Flame Off",
      "text_qc": 0
    },
    {
      "_time": "2017-10-01T12:00:03.001Z",
      "text": "Error code: 340",
      "text_qc": 0
    }
  ],
  "filterList": [
    "INTRODUCING FUEL",
    "MEANINGLESS ALARM",
    "Status@Flame On"
  ]
}

Response example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
{
    "output": [
        {
            "_time": "2017-10-01T12:00:02.001Z",
            "text_qc": 0,
            "text": "Status@Flame Off"
        },
        {
            "_time": "2017-10-01T12:00:03.001Z",
            "text_qc": 0,
            "text": "Error code: 340"
        }
    ]
}

Removing Duplicate Events

The Event Analytics Service can remove consecutive identical events. It receives as input a list of events and a splitInterval property in eventsMetadata (value in milliseconds), which defines the maximum time between an event and its duplicate. The output equals the input, but duplicates are removed.

Endpoint:

1
POST /removeDuplicateEvents

Content-Type: application/json

Request example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
{
  "eventsMetadata": {
    "eventTextPropertyName": "text",
    "splitInterval": 5000
  },
  "events": [
    {
      "_time": "2017-10-01T12:00:00.001Z",
      "text": "INTRODUCING FUEL",
      "text_qc": 0
    },
    {
      "_time": "2017-10-01T12:00:01.001Z",
      "text": "Status@Flame On",
      "text_qc": 0
    },
    {
      "_time": "2017-10-01T12:00:02.001Z",
      "text": "Status@Flame Off",
      "text_qc": 0
    },
    {
      "_time": "2017-10-01T12:00:03.001Z",
      "text": "Error code: 340",
      "text_qc": 0
    },
    {
      "_time": "2017-10-01T12:00:04.001Z",
      "text": "Error code: 340",
      "text_qc": 0
    },
    {
      "_time": "2017-10-01T12:00:06.001Z",
      "text": "INTRODUCING FUEL",
      "text_qc": 0
    },
    {
      "_time": "2017-10-01T12:00:08.001Z",
      "text": "Status@Flame On",
      "text_qc": 0
    },
    {
      "_time": "2017-10-01T12:00:09.001Z",
      "text": "Status@Flame Off",
      "text_qc": 0
    }
  ]
}

Response example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
{
    "output": [
        {
            "_time": "2017-10-01T12:00:00.001Z",
            "text_qc": 0,
            "text": "INTRODUCING FUEL"
        },
        {
            "_time": "2017-10-01T12:00:01.001Z",
            "text_qc": 0,
            "text": "Status@Flame On"
        },
        {
            "_time": "2017-10-01T12:00:02.001Z",
            "text_qc": 0,
            "text": "Status@Flame Off"
        },
        {
            "_time": "2017-10-01T12:00:03.001Z",
            "text_qc": 0,
            "text": "Error code: 340"
        },
        {
            "_time": "2017-10-01T12:00:06.001Z",
            "text_qc": 0,
            "text": "INTRODUCING FUEL"
        },
        {
            "_time": "2017-10-01T12:00:08.001Z",
            "text_qc": 0,
            "text": "Status@Flame On"
        },
        {
            "_time": "2017-10-01T12:00:09.001Z",
            "text_qc": 0,
            "text": "Status@Flame Off"
        }
    ]
}

Matching Patterns

Receives as input a numerical parameter maxPatternInterval (value in milliseconds) and three lists: patternsList, nonEvents, eventsInput. The output contains each pattern with corresponding matched events and the time window when these occur.

Endpoint:

1
POST /matchEventPatterns

Content-Type: application/json

Request example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
{
    "maxPatternInterval": 200000,
    "patternsList": [
        {
            "pattern": [
                {
                    "eventText": "INTRODUCING FUEL",
                    "minRepetitions": 1,
                    "maxRepetitions": 2
                },
                {
                    "eventText": "Status@Flame On",
                    "minRepetitions": 0,
                    "maxRepetitions": 1
                },
                {
                    "eventText": "Module STOP due to parameter assignment",
                    "minRepetitions": 1,
                    "maxRepetitions": 1
                }
            ]
        },
        {
            "pattern": [
                {
                    "eventText": "Downloading the module database causes module .. restart",
                    "minRepetitions": 1,
                    "maxRepetitions": 1
                },
                {
                    "eventText": "The SIMATIC mode was selected for time-of-day synchronization of the module with Id: ..",
                    "minRepetitions": 1,
                    "maxRepetitions": 1
                }
            ]
        }
    ],
    "nonEvents": [
        "Error 2.. occurred",
        "STOPPING ENGINE"
    ],
    "eventsInput": {
        "eventsMetadata": {
            "eventTextPropertyName": "text"
        },
        "events": [
            {
                "_time": "2017-10-01T12:00:00.001Z",
                "text": "Downloading the module database causes module 11 restart",
                "text_qc": 0
            },
            {
                "_time": "2017-10-01T12:00:01.001Z",
                "text": "The direction for forwarding the time of day is recognized automatically by the module",
                "text_qc": 0
            },
            {
                "_time": "2017-10-01T12:00:02.001Z",
                "text": "Status@Flame On",
                "text_qc": 0
            },
            {
                "_time": "2017-10-01T12:00:03.001Z",
                "text": "The SIMATIC mode was selected for time-of-day synchronization of the module with Id: 33",
                "text_qc": 0
            },
            {
                "_time": "2017-10-01T12:00:06.001Z",
                "text": "INTRODUCING FUEL",
                "text_qc": 0
            },
            {
                "_time": "2017-10-01T12:00:09.001Z",
                "text": "Module STOP due to parameter assignment",
                "text_qc": 0
            }
        ]
    }
}

Response example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
{
    "output": [
        {
           "patternIndex": 1,
                 "timeWindow": {
                    "startTimestamp": "2017-10-01T12:00:00.001Z",
                    "endTimestamp": "2017-10-01T12:00:03.001Z"
                 },
                 "matchedEvents": [
                    {
                       "_time": "2017-10-01T12:00:00.001Z",
                       "text_qc": 0,
                       "text": "Downloading the module database causes module 11 restart"
                    }, 
                    {
                       "_time": "2017-10-01T12:00:03.001Z",
                       "text_qc": 0,
                       "text": "The SIMATIC mode was selected for time-of-day synchronization of the module with Id: 33"
                    }
                 ]
              }, 
              {
                 "patternIndex": 0,
                 "timeWindow": {
                    "startTimestamp": "2017-10-01T12:00:06.001Z",
                    "endTimestamp": "2017-10-01T12:00:09.001Z"
                 },
                 "matchedEvents": [
                    {
                       "_time": "2017-10-01T12:00:06.001Z",
                       "text_qc": 0,
                       "text": "INTRODUCING FUEL"
                    },
                    {
                       "_time": "2017-10-01T12:00:09.001Z",
                       "text_qc": 0,
                       "text": "Module STOP due to parameter assignment"
                    }
                 ]
              }
    ]
}

Any questions left?

Ask the community


Except where otherwise noted, content on this site is licensed under the MindSphere Development License Agreement.