Splunk Search

How to sum the website's traffic?

houys
Loves-to-Learn

Hi Community,

We are using the Splunk Enterprise. From the Splunk Search & Reporting, how can we sum the site's traffic, like the monthly bandwidth?

Thanks,

Steve

Labels (2)
0 Karma

houys
Loves-to-Learn

Hi @gcusello,

We have all Drupal sites and the raw log likes this:

{"time":"2024-07-18T09:29:59.900525659-05:00","stream":"stdout","logtag":"F","message":"10.42.11.59 - - [18/Jul/2024:14:29:59 +0000] \"POST / HTTP/1.1\" 200 46989 \"-\" \"Microsoft Office/16.0 (Windows NT 10.0; Microsoft Word 16.0.17628; Pro)\"","kubernetes":{"pod_name":"apache-4","namespace_name" ...

We want to calculate total bandwidth.

0 Karma

yuanliu
SplunkTrust
SplunkTrust

The "message" node in the event is an Apache HTTPD access log.  So, apply Splunk's built-in access-extraction to it. ("message" should have been extracted by Splunk already.)

 

 

| rename message as _raw
| extract access-extractions
| timechart span=1month sum(bytes) as total_traffic

 

 

Your sample will give

total_traffic
46989

Here is an emulation using the sample you give, corrected for JSON completion:

 

 

| makeresults
| eval _raw = "{\"time\":\"2024-07-18T09:29:59.900525659-05:00\",\"stream\":\"stdout\",\"logtag\":\"F\",\"message\":\"10.42.11.59 - - [18/Jul/2024:14:29:59 +0000] \\\"POST / HTTP/1.1\\\" 200 46989 \\\"-\\\" \\\"Microsoft Office/16.0 (Windows NT 10.0; Microsoft Word 16.0.17628; Pro)\\\"\",\"kubernetes\":{\"pod_name\":\"apache-4\",\"namespace_name\":\"some name\"}"
| spath
| eval _time = strptime(time, "%FT%T.%9N%z")
``` data emulation ```

 

 

Play with it and compare with real data

Tags (1)
0 Karma

houys
Loves-to-Learn

Hi @yuanliu 

That's work, Thanks

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @houys ,

your question is too vague, could you better describe your data?

which data sources (technologies)?

Ciao.

Giuseppe

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Why Splunk Customers Should Attend Cisco Live 2026 Las Vegas

Why Splunk Customers Should Attend Cisco Live 2026 Las Vegas     Cisco Live 2026 is almost here, and this ...

What Is the Name of the USB Key Inserted by Bob Smith? (BOTS Hint, Not the Answer)

Hello Splunkers,   So you searched, “what is the name of the usb key inserted by bob smith?”  Not gonna lie… ...

Automating Threat Operations and Threat Hunting with Recorded Future

    Automating Threat Operations and Threat Hunting with Recorded Future June 29, 2026 | Register   Is your ...