Visualize a time counter

I am new to the ELK stack and trying to learn how to visualize some things. I have data coming in from one of our machine tools and I would like to make a simple counter that show the amount of time the machine has been running for a given time period my document looks like this.
@timestamp Nov 30, 2020 @ 18:51:11.217
@version 1
Samples.AccumulatedTime.@@data 1.98
Samples.AccumulatedTime.name p1CuttingTime
Samples.AccumulatedTime.subType x:CUTTING_TIME
_id IDjIG3YBNhsRe95vKY52
_index mtconnect-demo
_score -
_type _doc
componentId Mp1
dataItemId Mp1CuttingTime
deviceName OKUMA.MachiningCenterMA650-EAST
deviceUUID OKUMA.MachiningCenterMA650-EAST.190056
host mt-data-01
sequence 6,829,939
timestamp Nov 30, 2020 @ 18:48:56.714
type json

I know I can get a COUNT of the p1CuttingTime but how do I get the value of the Samples.AccumulatedTime.@@data that goes along with p1CuttingTime? Any help would be appreciated as well as pointers to any tutorials on working with Visualizations

Hi @fastxl,
As I understood you want to sum up Samples.AccumulatedTime.@@data from your documents?
Then you should use sum aggregation for this.

For example, using Lens:

  1. Drop Samples.AccumulatedTime.@@data field into editor
  2. Pick "metric" chart type
  3. Pick a "sum" function
1 Like

Thanks for the direction it has helped. However Samples.AccumulatedTime.@@data holds other data as well for other values. So just displaying the SUM of it doesn't give me what I want. I need to display the SUM of Samples.AccumulatedTime.@@data when Samples.AccumulatedTime.name p1CuttingTime. Not sure how to do that.

@fastxl, can you sum up all Samples.AccumulatedTime.@@data and then use Kibana's filter to include only documents with Samples.AccumulatedTime.name:p1CuttingTime ?

I am talking about this filter bar:

Screenshot 2020-12-04 at 10.10.17

1 Like

Yes! That worked. I didn't realize that the filters would stay with the visualization. Thank you for the direction.

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.