I have spent days working on this, can someone help? how to populate previous week results? Also there are different license keys for same errors that is why it is showing 2 entries.
I have the f...
See more...
I have spent days working on this, can someone help? how to populate previous week results? Also there are different license keys for same errors that is why it is showing 2 entries.
I have the following code
index=test sourcetype=dhi:testdata ErrorCode!=0 | `DedupDHI` | bucket _time span=1w | lookup table1 LicenseKey OUTPUT CustomerName | eval CustomerName=coalesce(CustomerName,LicenseKey) | stats count as Result by CustomerName,ErrorCode,_time | eventstats sum(Result) as Total by CustomerName | eval PercentOfTotal = round((Result/Total)*100,3) | streamstats current=f latest(Result) as Result_Prev by CustomerName,ErrorCode | eval PercentDifference = round(((Result/Result_Prev)-1)*100,2) | fillnull value="0" | append [ search index=test sourcetype=dhi:testdata ErrorCode!=0 | `DedupDHI` | lookup table1 LicenseKey OUTPUT CustomerName | eval CustomerName=coalesce(CustomerName,LicenseKey) | stats count as Result by CustomerName | eval ErrorCode="Total", PercentOfTotal=100] | fillnull value="0" | lookup table2 ErrorCode OUTPUT Description | lookup table1 LicenseKey OUTPUT CustomerName | eval CustomerName=coalesce(CustomerName,LicenseKey) | eval Error=if(ErrorCode!="Total", ErrorCode+" ("+coalesce(Description,"Description Missing - Update table2")+")", ErrorCode) | rename Result_Prev as "Previous Week Results", PercentDifference as " Percent Difference", PercentOfTotal as "Percent of Total" | fields CustomerName, Error, Result,"Previous Week Results", " Percent Difference" , "Percent of Total" | sort CustomerName, Error, PercentDifference
OUTPUT -
CustomerName
Error
Result
Previous Week Results
Percent Difference
Percent of Total
_time
customer_1
1002 (Invalid Address State Code. The two digit state code is invalid)
4
0
0
3.361
2022-08-12T00:00:00.000-0500
customer_1
1003 (Invalid Birth Year)
1
0
0
0.84
2022-08-12T00:00:00.000-0500
customer_1
1006 (Invalid UnderwritingState)
1
0
0
0.84
2022-08-12T00:00:00.000-0500
customer_1
1013 (Invalid Drivers License Format)
12
0
0
10.084
2022-08-12T00:00:00.000-0500
customer_1
1013 (Invalid Drivers License Format)
1
12
-91.67
0.84
2022-08-19T00:00:00.000-0500
customer_1
1023 (Invalid Name)
3
0
0
2.521
2022-08-12T00:00:00.000-0500
customer_1
1027 (Invalid UnderwritingState)
87
0
0
73.109
2022-08-12T00:00:00.000-0500
customer_1
1027 (Invalid UnderwritingState)
1
87
-98.85
0.84
2022-08-19T00:00:00.000-0500
customer_1
1305 (Unable to connect to data provider)
9
0
0
7.563
2022-08-12T00:00:00.000-0500
customer_1
Total
119
0
0
100
1969-12-31T18:00:00.000-0500
customer_2
1023 (Invalid Name)
16
0
0
55.172
2022-08-12T00:00:00.000-0500
customer_2
1201 (Lookback Date Not Set / Offset = 0)
1
0
0
3.448
2022-08-12T00:00:00.000-0500
customer_2
1305 (Unable to connect to data provider)
11
0
0
37.931
2022-08-12T00:00:00.000-0500
customer_2
1305 (Unable to connect to data provider)
1
11
-90.91
3.448
2022-08-19T00:00:00.000-0500
customer_2
Total
29
0
0
100
1969-12-31T18:00:00.000-0500
customer_3
1023 (Invalid Name)
3
0
0
20
2022-08-12T00:00:00.000-0500
customer_3
1027 (Invalid UnderwritingState)
11
0
0
73.333
2022-08-12T00:00:00.000-0500
customer_3
9999 (Timeout expired (9999))
1
0
0
6.667
2022-08-12T00:00:00.000-0500
customer_3
Total
15
0
0
100
1969-12-31T18:00:00.000-0500
customer_4
1003 (Invalid Birth Year)
1
0
0
3.846
2022-08-12T00:00:00.000-0500
customer_4
1013 (Invalid Drivers License Format)
5
0
0
19.231
2022-08-12T00:00:00.000-0500
customer_4
1013 (Invalid Drivers License Format)
1
5
-80
3.846
2022-08-19T00:00:00.000-0500
customer_4
1023 (Invalid Name)
14
0
0
53.846
2022-08-12T00:00:00.000-0500
customer_4
1026 (Drivers License Number is a required field)
3
0
0
11.538
2022-08-12T00:00:00.000-0500
customer_4
9999 (Timeout expired (9999))
1
0
0
3.846
2022-08-12T00:00:00.000-0500
customer_4
9999 (Timeout expired (9999))
1
1
0
3.846
2022-08-19T00:00:00.000-0500
customer_4
Total
26
0
0
100
1969-12-31T18:00:00.000-0500