Splunk Search

How to remove duplicate values in a column of table

priya1926
Path Finder

My Query is 

 

index=windows Type=Disk host IN (abc) FileSystem="*" DriveType="*" Name="*"
| dedup host, Name
| table _time, host, Name
| sort host, Name
| join type=left host [| search index=perfmon source="Perfmon:CPU" object=Processor collection=CPU counter="% Processor Time" instance=_Total
host IN (abc)
| convert num(Value) as value num(pctCPU) as value
| stats avg(value) as "CPUTrend" max(value) as cpu_utz by host
| eval "Max Peak CPU" = round(cpu_utz, 2)
| eval "CPUTrend"=round(CPUTrend, 2)
| fields - cpu_utz
| sort -"Peak CPU"
| rename "Max Peak CPU" AS "maxCPUutil"
| dedup "maxCPUutil"
| table _time, host, "maxCPUutil"]
| table host, "maxCPUutil", Name

 



I have this below output

host maxCPUutil Name

host                               maxCPUutil       Name
abc                                  5.59                       c:
abc                                  5.59                       E:
abc                                   5.59                       F:

 

What i want is

host                                   maxCPUutil                     Name
abc                                          5.59                                     C:
                                                                                                 E:
                                                                                                 F:

Labels (6)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust

Yes, you will either get a row for each Name with the data repeated when the host and maxCPUtil don't change; or a row for each host and maxCPUtil with a multivalue field of Names

View solution in original post

ITWhisperer
SplunkTrust
SplunkTrust
| stats values(Name) as Name by host maxCPUutil
0 Karma

priya1926
Path Finder

but @ITWhisperer  my result has multiple hosts.. Not single host. Output should be 

1. abc 35.16 C:
2.                       😧
3.                       E:
4. def 45.56 C:
5.                       I:
6.                      J and etc

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

I am not sure I understand the issue - the host is mentioned in the by clause so you should get a line for each host maxCPUutil combination with the Names listed in a multivalue field.

0 Karma

priya1926
Path Finder

@ITWhisperer any alternate method?

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

What happened when you added the line I suggested already?

0 Karma

priya1926
Path Finder

its like all the drive letters are coming in  a single cell, single row.. they need to come in different rows.

0 Karma

PickleRick
SplunkTrust
SplunkTrust

You could do that but what for? What's the point of having results regarding the same entity with no connection to one another? If you, for example, resort the results you can't say which host the "empty" rows are for.

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust
| mvexpand Name
0 Karma

priya1926
Path Finder

same like earlier

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Yes, you will either get a row for each Name with the data repeated when the host and maxCPUtil don't change; or a row for each host and maxCPUtil with a multivalue field of Names

Get Updates on the Splunk Community!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...