Splunk Search

How to chart URLS by error code percentage

mgpspr
New Member

We are grabbing logs from nginx. I would like to know how I can chart URLS that are returning a 408 error code as well as a percentage from the overall status codes. Here is an example of what I am trying to do:

Build a chart that shows all the PUTs and POSTs requests followed by the URL, then show the percentage of the error code out of all percentage codes in the log.

"PUT /borrower/api/v1/prospect/update HTTP/1.1" 408 0
"POST /borrower/api/v1/registration HTTP/1.1" 408 51
0 Karma
1 Solution

jtrucks
Splunk Employee
Splunk Employee

First, check the nginx log parsing post on Answers for parsing your logs.

Then if you name your fields "path" and "code" you simply do something like:

... | top code limit=0 | table code, percentage | where code=408

To give you a breakdown of the percentage of codes without the default 10 items to list all options in case there are more than 10 and your 408 code is low on the list, then pull out the code and percentage only as a table, limited to only entries with the 408 code.

There are a number of other ways to slice this up, as well, but this ought to get you want you need.

--
Jesse Trucks
Minister of Magic

View solution in original post

jtrucks
Splunk Employee
Splunk Employee

First, check the nginx log parsing post on Answers for parsing your logs.

Then if you name your fields "path" and "code" you simply do something like:

... | top code limit=0 | table code, percentage | where code=408

To give you a breakdown of the percentage of codes without the default 10 items to list all options in case there are more than 10 and your 408 code is low on the list, then pull out the code and percentage only as a table, limited to only entries with the 408 code.

There are a number of other ways to slice this up, as well, but this ought to get you want you need.

--
Jesse Trucks
Minister of Magic

mikelanghorst
Motivator

Though if you're only concerned with status=408, I'd go ahead and put it in the originating search, before the "|top" shown here.

0 Karma

jtrucks
Splunk Employee
Splunk Employee

mikelanghorst, that prevents you from getting the % 408 codes of the whole.

--
Jesse Trucks
Minister of Magic
0 Karma

Fergal111
Path Finder

Is there a solution here? This will not get percentage of 408 errors over total requests.
Thanks,

0 Karma

aljohnson_splun
Splunk Employee
Splunk Employee

@fergal111 do something like

... | top url by status

^ there are any number of similar solutions

0 Karma
Get Updates on the Splunk Community!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...