Splunk Search

Time Chart and DBXquery

shubhamkanugo
New Member

I am new to splunk. I have a DB connection from where I am fetching a table. I want to create a dashboard for with x-axis as time and Y-axis as count of table in every hour.
i tried with timechart function but I am unable to achive my goal. I am getting data without timechart.

| dbxquery query="SELECT * FROM \"CASE\"" | timechart count by Id

this is my query.

Tags (1)
0 Karma

to4kawa
Ultra Champion
| makeresults
| eval _raw="XYZ 521463 PQR LMN 2012-09-14 18:13:12.919648"
| rex "(?<time>\d{4}-\d{2}-\d{2} \S+$)"
| eval _time =strptime(time,"%F %T.%6Q")
| timechart count

I am not sure id , you should extract from the result.

0 Karma

to4kawa
Ultra Champion

Can you provide the result, | dbxquery query="SELECT * FROM \"CASE\""?

0 Karma

shubhamkanugo
New Member

update:
Instead of * it is count(1) in query so it is giving number of rows as result.

| dbxquery query="SELECT count(1) FROM \"CASE\"" | timechart count by Id

@to4kawa

0 Karma

to4kawa
Ultra Champion

@shubhamkanugo

timechart needs epoch time value.
so, I say again,
Can you provide the result, | dbxquery query="SELECT * FROM \"CASE\"" ?

0 Karma

shubhamkanugo
New Member

@to4kawa
I will not be able to provide results but you can consider result of any general table like person or organization having ID and timestamps also as columns.

0 Karma

to4kawa
Ultra Champion

I see and don't want such sensitive data.
but you can't provide sample?

0 Karma

shubhamkanugo
New Member

XYZ 521463 PQR LMN 2012-09-14 18:13:12.919648

Above is the sample row we get from that query, last column is time stamp with date.
@to4kawa

0 Karma

shubhamkanugo
New Member

@to4kawa
Hi If you are OK it will be more comfortable for me to understand your answer with some explanation.

0 Karma

to4kawa
Ultra Champion

If you are not sure rex , check regex101
if you are not sure other SPL, try Fundametal 1

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...