Splunk Search

How to find employee manager up to levels above until CEO using dbquery?

LintuMathews
Explorer

I have a report that I run against Oracel db using dbquery to gather the following fields in a table
EMPLOYEEID ,EMPLOYEE FULL NAME, MANAGERID
2561, Mark Antony, 3560
3560, John Roberts , 210
210, Mathew Nathaniel, 6230
31, David Blan, 65

Need help to get an output like one below:-
EmployeeID, EMPLOYEE FULL NAME, MANAGERID LEVEL-1, MANAGER NAME LEVEL-1, MANAGERID LEVEL -2, MANAGER NAME LEVEL-2
2561, Mark Antony, 3560, John Roberts,210, Mathew Nathaniel

Tags (3)
0 Karma

jcoates
Communicator

this is a recursion problem, and because it's unclear how many levels you'll need to go to, you should do it in two steps.

  1. index the data with a simple dbinput
  2. use a dbxlookup to figure out bosses for whoever shows up on the dashboard when you look at the data
0 Karma

LintuMathews
Explorer

the actual data has up to 8 levels that is the maximum we have, for some like the CEO & certain staff will not have supervisor ID

0 Karma

jcoates
Communicator

More than one level is assumed, no one really has a flat organization. It doesn't make any difference to my advice. Missing data is also normal, but not your problem. In fact your dashboard might even inspire people to start fixing the source data.

0 Karma
Get Updates on the Splunk Community!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

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