Hello and welcome back to the Splunk Enterprise Certified Administrator course on Cyber. This is the B two lab where we're gonna be doing a deep dive on how to use the Splunk be tool command line tool. So in this video, we're gonna go over this syntax for the command.
What we use the command for I'll run a couple example commands.
And then I will also demonstrate configuration file precedence and lexical graphical order presidents by basically manipulating different files in different places and then showing you which configurations are being applied using be tool. So without further do, we can get started and actually
look at what this be Tool
command is. So any time you're looking at a Splunk command line tool the place I would recommend starting is by just using Splunk help command to get more information about the commander interested in. So in this case will do help be tool,
and you can see that they give you a quick description. It's used to view or validates pulling configuration files, and it takes into account configuration, file layering and user app context.
So what that basically means is when you run this tool What it does is whatever configuration file you specify. It will list what the configurations from all of those different files on disk would look like when they are compiled and take into account configuration file precedence.
in other words, it gives you
what setting Splunk is actually applying to the data based on what is on the disk.
One thing to note here, though, is
this tool does run off of the configuration files on disk, so you could have different settings written in your files. You might have made updates
to the files and not restarted Splunk. So
the settings that are being applied in memory could be different than what's being spit out by this. Be tool. So if everything coming from B Tool looks correct, but Splunk is still applying improper settings to your data,
try running a restart just to refresh the configurations. They're loaded in memory, and hopefully that will solve your problems.
But now that we got rid of her, we got that out of the way. Let's talk quickly about the syntax, so when you use this command, you're going to write Splunk. You're right. The path to this blank. Execute herbal your specified be tool because that's what we want to use.
You'll specify the configuration file you're interested in looking at the configurations for and that will be like server or inputs or outputs or props transforms whatever it is without the dot com extension, and then you'll specify list which,
all of the settings for that file. And then there's some options that you can apply to narrow down your results, because
if we run this, I'll demonstrate just how much data it spits out. So let's just look at inputs for this example.
Oh, sorry, I forgot to write Beetle,
but you can see this is a lot of information. This is literally all the configurations Splunk has for every input. And this is just a fresh in Seoul of Splunk. So a production system where you have a lot of inputs configured would be way more texts than even this, and this is already kind of a lot to look at.
So that's why they give you additional means of narrowing down the data
so you could specify a specific stands the name so we'll do this one
and then just get the settings for that stanza
or you could specify
but we don't know any APS right now. So before we get to that, we should talk about the debug command. So if you are option if you add the debug parameter to your be tool command, it will tell you the file path that each individual configuration comes from.
So here we can see that's an happening, so we'll use that as an example for app equals.
And now we're just looking at the settings that come from that introspection generator at
you can see. It's just these two stanzas,
de boat tools like Super Useful because you can see on, especially if we narrow down to Let's go back to a specific stanza. Let's look that TCP again clear. Just so we have a
fresh view, you could see
where each configuration is coming from, and all the different places that a configuration for this stance or resides so that will help you determine where you need to make your changes toe override what's already existing.
So, for example, if we wanted to change this connection, host equals DNS. We see it comes from default inputs dot com. So if you remember our conversation about configuration file precedents, there's three places we could put this that would override that.
We could put it in an app default directory, an APP, local directory or the system local directory and overwrite this value.
So let's just do a demonstration of that so you can actually see how configuration file presidents works and also how you can use be tool Teoh, basically see. Okay, I made this new configuration. Will it take effect?
So we're gonna keep operating off the assumption that we want to change this value
make a new app. Uh, this So this make their command is what we're gonna use to make a directory and dash. He's gonna let me make multiple directories at the same time. So we'll go to Ops, Blunk, etc. APs because this is where APS are. And basically all app really is in. Splunk is
a directory with some configuration files
in it that resides in this path.
So we'll just pull this test app and we'll make it default.
make a new inputs dot com file there and we will specify that we want to work on the TCP stands up and we will add the connection post. And since the old value is DNS, just to demonstrate this works will make this not in this.
So let's run RB tool again to see what the settings are.
And as you can see, this line is now coming from our test app and is not DNS instead of being DNS and coming from default implants.
So again, if we wanted to override this value we could use, we could still use configuration pop presence. We could just make a new directory.
Oh, and rip and remember.
So if data was coming in with this inputs, this connection host that Splunk would be using still be this old value because we haven't restarted Splunk. So it's still operating off these old configurations. So that's what I was talking about earlier. So even though be tools shows that this value
would be not Deanna's,
as long as Splunk hasn't been restarted, its still using its it already compiled, right? So when schooling starts that compiles all these configurations and determines what set of configurations that should use, So unless we restart, this won't get loaded, so just keep that in mind.
But now if we want toe manipulate this some or we can make
directory for local come figs,
Um, and then another input stuck on from there
specify the same stands Us. So that's a conflicting setting,
and we'll just suit next host People's definitely Dennis and will
right that file and then we'll run R B Tool Command again. And you can see now this APP local file is taking precedence over the APP default file.
So there's one more thing I want to demonstrate with configuration file precedents, and that's gonna be actually lexical graphical order, which only comes into play if you have to, APs
that have conflicting settings.
So if I made another app that that controls this same value
then Splunk will decide which configuration to apply based on lexical graphical order. So if you remember lexical graphical order, highest order would be a number.
Second highest would be alphabetical capital, a tow lower keeper, capital a toe,
um, Capital Z, and then finally, lower case A to lower Casey. So if we wanted to take precedence over this test app we can make a new app called
Test and put the file in the same context. Because if we
then the local would still take precedence over that. This lexical graphical order only comes in a place as like a tiebreaker.
well that this way, because it's a little bit faster
and then foot stock calm
so we'll apply the same stands up.
The next host equals,
Okay, so we'll save that. Then we'll run R B Tool one more time and you can see
that did take precedence because of lexical graphic order so that capital t takes precedence over lower case T.
And so that's how lexical graphical works in deciding basicly tiebreakers between APS.
Okay, so we've looked at
basically everything we need to. We talked about the beetle app what it is, it will be tool command line tool, what exactly you use it for and that's analyzing configuration files on disk.
We did emphasize that it will show you what files are what configurations would be loaded into *** based on what is on disc. But that does not mean that that is what's loaded in memory. Splunk does have to be restarted toe update your new configurations.
precedents order again and actually demonstrated how that works. And then we also demonstrated how lexical graphical order would work, I guess, just for context, I'll explain when to use this. I very rarely have had to use lexical graphical order toe override a setting.
But one recent example was I was working with a customer
and they had a subset of their forwarders that they want to have send data to Splunk, but also to 1/3 party system. So I already had an app that was sending to all forwarders to give them the basic outputs dot com configuration to just forward to the *** indexing tear.
But now I needed a different set of outputs icon configurations to apply on Lee to this subset of servers that will send to 1/3 party. So I made,
with those settings that only send to that subset of servers, and I'm just named the APP. The same thing is the normal outputs dot com app that I had deployed but all capitals so that I could still leave it so that that generic app got sent to every host
and still no, that my more specific app would override it in the cases where it needed to.
So that's like the only use case I've really had to use that it's not super common, but still good to know that you can do that and how
But I think that covers everything you need to know about. Be tool. You should have enough information to leverages tool in your job duties as a Splunk administrator and hopefully should be very helpful with troubleshooting and testing your inputs that wraps it up for this lab. Look forward to senior next one.