Splunk Search

timechart data derived from lookup

mcaulsc
Path Finder

Hi,

I have data that contains a field in binary that i can use a lookup table to map the various binary values to a value that makes sense. That works fine:
chart count by TPTYPE|lookup ims_tptype_lookup TPTYPE OUTPUT trantype AS TPTYPE

However rather than a single column for each value over the entire interval I'd like to be able to show the counts per hour which is where I seem to be stumbling. I either get the original binary value or I get some errors in the search.

 bin _time span=1h |timechart count by TPTYPE|lookup ims_tptype_lookup TPTYPE OUTPUT trantype AS TPTYPE

Does what I want but the lookup doesn't happen in for the chart data, if I move the lookup before the timechart command I get errors.

Could anyone point me in the right direction please?

Steve

Labels (2)
1 Solution

mcaulsc
Path Finder

ah, found the issue, it goes back to permissions on the lookup. It must do something different between the ways the search is constructed. Even though it was just me testing the search when I changed the permissions on the lookup table and definition to READ for all in app it started to work.

Thanks again for your response.

View solution in original post

mcaulsc
Path Finder

ah, found the issue, it goes back to permissions on the lookup. It must do something different between the ways the search is constructed. Even though it was just me testing the search when I changed the permissions on the lookup table and definition to READ for all in app it started to work.

Thanks again for your response.

mcaulsc
Path Finder

Thanks for the response, I now have:

lookup ims_tptype_lookup TPTYPE OUTPUT trantype AS TPTYPE |timechart count by TPTYPE span=1h

which gives me the following errors:

Streamed search execute failed because: Error in 'lookup' command: Could not construct lookup 'ims_tptype_lookup, TPTYPE, OUTPUT, trantype, AS, TPTYPE'

bowesmana
SplunkTrust
SplunkTrust

@mcaulsc 

A couple of things...

You don't need the bin command with timechart, as you can do

| timechart span=1h ...

however, after the timechart, you no longer have the TPTYPE field, only the values, so you have to do the lookup prior to the timechart. 

What errors do you get?

 

isoutamo
SplunkTrust
SplunkTrust
Can you remove bin _time span=1h and add span=1h to the timechart command.
0 Karma
Get Updates on the Splunk Community!

Unlock Database Monitoring with Splunk Observability Cloud

  In today’s fast-paced digital landscape, even minor database slowdowns can disrupt user experiences and ...

Purpose in Action: How Splunk Is Helping Power an Inclusive Future for All

At Cisco, purpose isn’t a tagline—it’s a commitment. Cisco’s FY25 Purpose Report outlines how the company is ...

[Upcoming Webinar] Demo Day: Transforming IT Operations with Splunk

Join us for a live Demo Day at the Cisco Store on January 21st 10:00am - 11:00am PST In the fast-paced world ...