Dashboards & Visualizations

How to create user logon session line chart by timechart command

p2akira
Engager

Hi all, 

I have data in below that indicates logon and logoff time.

_timeuserstartTimeendTime
20/12/04 18:07:03.000A16070728231607073562
20/12/04 17:53:22.000B16070720021607074229
20/12/04 16:21:19.000A16070664791607066494
20/12/04 16:07:32.000C16070656521607065719

"_time" is equal to startTime but startTime is epoch time.

I would like to plot this time series data to line chart using timechart command.

Like, x axis indicates time with 1minutes span, and y axis indicates each user name and plot data to be 1 between session startTime and endTime.

Labels (3)
Tags (1)
0 Karma
1 Solution

to4kawa
Ultra Champion
index=_internal | head 1 | fields _raw 
| eval _raw="_time	user	startTime	endTime
20/12/04 18:07:03.000	A	1607072823	1607073562
20/12/04 17:53:22.000	B	1607072002	1607074229
20/12/04 16:21:19.000	A	1607066479	1607066494
20/12/04 16:07:32.000	C	1607065652	1607065719"
| multikv forceheader=1
| rex "(?<time>\S+ \S+)\s+(?<user>\w)\s+(?<startTime>\d+)\s+(?<endTime>\d+)"
| eval _time=strptime(time,"%y/%m/%d %T.%3Q")

| eval time=mvrange(startTime,endTime,60)
| mvexpand time
| stats count by time user
| rename time as _time
| timechart span=1min cont=f count by user

try column chart with stack

View solution in original post

0 Karma

to4kawa
Ultra Champion
index=_internal | head 1 | fields _raw 
| eval _raw="_time	user	startTime	endTime
20/12/04 18:07:03.000	A	1607072823	1607073562
20/12/04 17:53:22.000	B	1607072002	1607074229
20/12/04 16:21:19.000	A	1607066479	1607066494
20/12/04 16:07:32.000	C	1607065652	1607065719"
| multikv forceheader=1
| rex "(?<time>\S+ \S+)\s+(?<user>\w)\s+(?<startTime>\d+)\s+(?<endTime>\d+)"
| eval _time=strptime(time,"%y/%m/%d %T.%3Q")

| eval time=mvrange(startTime,endTime,60)
| mvexpand time
| stats count by time user
| rename time as _time
| timechart span=1min cont=f count by user

try column chart with stack

0 Karma

p2akira
Engager

Thank you!

That's what I wanted to do.

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @p2akira,

To do what you like, you should explore the timeline Visualization https://splunkbase.splunk.com/app/3120/

Ciao.

Giuseppe

0 Karma

p2akira
Engager

Hi @gcusello ,

Thank you your app suggestions

I'm aware of that app, but I can't install it because our Splunk is deployed on a closed network or can't bring app packaged file.
Therefore, I would like to implement it by using the line chart that I can use by default.

Thank you.

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Break the Build: Inside the KubeDoom Lounge at .conf26

    You step up to the machine. The pixelated corridors of a certain 1993 FPS load in front of you, EMP Pulse ...

Splunk Auto Ingestion Parallel Pipeline Scaling

Why this feature matters Many Splunk environments experience ingestion pressure long before the host is fully ...

Best Practices: Splunk auto adjust pipeline queue

When you enable autoAdjustQueue in Splunk, maxSize should be understood as the queue size Splunk starts with ...