Splunk Search

How to create new columns by adding columns from a timechart output?

richtate
Path Finder

Good day,

I have this SPL:

index=test_7d sourcetype="Ibm:BigFix:CVE" earliest=-1d
| search FixletSourceSeverityTxt="Critical" OR FixletSourceSeverityTxt="Urgent"
| eval ReleaseDtm=strptime(FixletSourceReleaseDtm, "%Y-%m-%d")
| where ReleaseDtm>1672531199 ```Epoch time for 12/31/22 23:59:59, this gets only 2023 fixlets```
| eval _time = ReleaseDtm
| makemv FixletCVETxt
| eval cvecount=mvcount(FixletCVETxt)
| eval cvetotal=cvecount * RemediatedComputerCount
| timechart span=1mon sum(cvetotal) as cvetotal sum(RemediatedComputerCount) as RemediatedComputerCount by ComputerDatabaseId
 
 
That has the output of:
 
_time RemediatedComputerCount: 0 RemediatedComputerCount: 1 cvetotal: 0 cvetotal: 1
2023-01 113575 29512 7177373 1619396
2023-02 230629 42239 4779801 1063153
2023-03 253770 55769 7246548 1792831
2023-04 139419 36156 8175076 2192272
2023-05 144117 40335 2781698 740369
2023-06 314684 81621 5574141 1420760
2023-07 163672 47112 13643474 3957452
2023-08 281891 65004 6481422 1587176
2023-09 4596 6508 62384 98312

 

I would like to add the 'RemediatedComputerCount: #' columns to a total column by month next to the existing columns.  Then add another column with totals for 'cvetotal: #'.  I don't want totals of each column for a grand total at the bottom, just the total of the like columns in a new one by _time.

Suggestions?  Thanks!

Labels (4)
Tags (1)
0 Karma
1 Solution

bowesmana
SplunkTrust
SplunkTrust

Use the addtotals command which will sum up the fields you specify - it supports wildcards

 

| addtotals RemediatedComputerCount* fieldname=RemediatedComputerCount
| addtotals cvetotal* fieldname=cvetotal

 

 

View solution in original post

bowesmana
SplunkTrust
SplunkTrust

Use the addtotals command which will sum up the fields you specify - it supports wildcards

 

| addtotals RemediatedComputerCount* fieldname=RemediatedComputerCount
| addtotals cvetotal* fieldname=cvetotal

 

 

richtate
Path Finder

Thanks that worked.  I was running down the addcoltotals letting the column get in my way.  Simple solution, thanks!

Tags (1)
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!

Introducing ITSI 5.0: Unified Visibility and Actionable Insights

Introducing ITSI 5.0: Unified Visibility and Actionable Insights Tuesday, July 21, 2026  |  10:00AM PT / ...

Inside Splunk Agent Observability: Understanding Agent Behavior, Tokens & Costs

Inside Splunk Agent Observability:Understanding Agent Behavior, Tokens & Costs Thursday, August 06, ...

From Data to Insight: Announcing the Winners of the Splunk Dashboard Contest

Hi Splunkers, First off, thank you to everyone who participated in our very first From Data to Insight: The ...