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!

Splunk + ThousandEyes: Correlate frontend, app, and network data to troubleshoot ...

 Are you tired of troubleshooting delays caused by siloed frontend, application, and network data? We've got a ...

Splunk Observability for AI

Don’t miss out on an exciting Tech Talk on Splunk Observability for AI!Discover how Splunk’s agentic AI ...

🔐 Trust at Every Hop: How mTLS in Splunk Enterprise 10.0 Makes Security Simpler

From Idea to Implementation: Why Splunk Built mTLS into Splunk Enterprise 10.0  mTLS wasn’t just a checkbox ...