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!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...