I'm trying to correlate session-id's from two different events, a heartbeat sent every 10 minutes and a disconnect which could be sent any time. The goal is to get the number of active sessions for the last 10 minutes in a kibana visualization.
I don't think this is possible with the raw events in Elasticsearch, is that correct?
Would a logstash pipeline be the general approach here?
It seems like I should be able to use something like this Aggregate Filter example, using the heartbeat to add session-ids to a periodic "active sessions" event and the shutdown to remove the session-id. Does this seem like a reasonable approach or is there something simpler?
If this is the approach, can I initialize the next "active sessions" array from the most recent active-sessions event?
As you indicate, Logstash has some features to join related documents in the ingest stream.
Another general approach is to land the events in the index first and then use a job to periodically (every few seconds?) update a separate "session" index with the latest recorded activities in the event index.
See: "entity-centric indexing".
Thanks Mark, this entity-centric indexing technique looks like exactly what I'm aiming for!
I'm still curious if such an index could be created in logstash, rather than introducing an extra set of scripts. It looks like it might be possible to recreate with the following:
Group events together and apply a timeout to make sure they are updated at the required interval: like this example.
I'm not a logstash expert but I'd suggest checking what happens when you use a system that relies on joining things together using a transient blob of memory. The questions I would have are:
Do I have to route all related events through the same logstash process?
Does the memory grow endlessly waiting for "start" events to match their equivalent "end" event?
How much memory do I need to hold a window big enough to tally all starts with ends?
What happens to in-flight sessions when the power goes off?
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.