Splunk Search

Search for sample to convert my Pivot Table from excel to SPL, have raw data

puppy0723
New Member

Hi, 

I am a beginner of SPLUNK and SPL. 

Recently I am asked to replace my statistic table from excel  into SPLUNK to control windows server status. 

Below is my brief raw data in csv format

systemNameDepartmentosVersionpatchesDiskD_total_size_TBDiskD_free_size_TBLincense_end
HOST00001AWindows 2012 R2KB56:KB59:KB94:KB98:KB113:KB11841.81250.8310546882023/7/25
HOST00002AWindows 2016KB107KB131:KB13540.5781253.0341796882023/8/2
HOST00003XWindows 2012 R2KB56:KB59:KB94:KB98:KB11341.81250.5380859382020/10/15
HOST00004XWindows 2012 R2KB56:KB59:KB94:KB98:KB113:KB11841.812510.323242192022/12/25
HOST00005XWindows 2016KB107KB131:KB13541.81251.8037109382023/7/25
HOST00006AWindows 2019KB36:KB37:KB39:KB40:KB4140.5781252.6826171882022/12/25
HOST00007YWindows 2019KB36:KB37:KB39:KB40:KB41:KN5040.5781256.9482421882023/1/25
HOST00008YWindows 2016KB107KB131:KB13541.81250.0341796882023/1/25
HOST00009YWindows 2016KB107KB13141.81250.0341796882022/12/25
HOST00010AWindows 2016KB107KB131:KB13541.81256.6318359382019/5/17

 

And  I want to summarize the data to a table like this, the key is to judge server is deployed the target patch or not of each version.

 Windows 2012 R2Windows 2012 R2Windows 2016Windows 2016Windows 2019Windows 2019Total
Departmentnon-patchedKB118non-patchedKB135non-patchedKB41 
A0102014
X1101003
Y0011013
Total12140210

And another table to check license duration is less than one year or not.

systemNameDepartmentLincense_endLicense_life < 1 yearLicense_expired
HOST00001A2023/7/25NN
HOST00002A2023/8/2NN
HOST00003X2020/10/15YN
HOST00004X2022/12/25NN
HOST00005X2023/7/25NN
HOST00006A2022/12/25NN
HOST00007Y2023/1/25NN
HOST00008Y2023/1/25NN
HOST00009Y2022/12/25NN
HOST00010A2019/5/17YY

 

I am not familiar with SQL and SPL, could anyone provide some hint or example resouce to me , please help~

I can merely have a SPL to count total of each osVersion and Dept like this , but have no ieda to divide into patched or not and join the sub-search....

index=windows sourcetype=csv search Department In("A", "X", "Y") | stats count(osVersion) by Department patches

 

 

Labels (1)
Tags (1)
0 Karma
Get Updates on the Splunk Community!

Upcoming Webinar: Unmasking Insider Threats with Slunk Enterprise Security’s UEBA

Join us on Wed, Dec 10. at 10AM PST / 1PM EST for a live webinar and demo with Splunk experts! Discover how ...

.conf25 technical session recap of Observability for Gen AI: Monitoring LLM ...

If you’re unfamiliar, .conf is Splunk’s premier event where the Splunk community, customers, partners, and ...

A Season of Skills: New Splunk Courses to Light Up Your Learning Journey

There’s something special about this time of year—maybe it’s the glow of the holidays, maybe it’s the ...