The license usage logs are present under an index ABC, but in inputs.conf in which the _meta field is present sends data to different index winsec.
Will the below query provide the exact license usage?
index=winsec | eval b=len(_raw) |eval GB=(b/(102410241024)) | stats sum(GB)
this will look at the length of the raw data in winsec index
if all your data goes only to that index (not the internal splunk data) than it will be pretty accurate.
will highly recommend to go back to default and use the license master correctly
For getting license usage of a specific index I would recommend using the license_usage.log in the _internal index. Here is a recommended search:
index=_internal source=*license_usage.log type="Usage" | eval indexname = if(len(idx)=0 OR isnull(idx),"(UNKNOWN)",idx) | eval sourcetypename = st | stats sum(b) as b by _time, indexname, sourcetypename | eval GB=(b/1024/1024/1024) | fields _time, indexname, sourcetypename, GB | search indexname=* sourcetypename=* | stats sum(GB)
You can change the filters to hit specific sourcetypes or indexes. You can add host/source metadata to the search but those values run the risk of being squashed in license_usage.log and may not be present in every event. The reason h or s may not be present in all events is described well here: https://answers.splunk.com/answers/48542/blank-h-and-s-in-license-usage-log.html
The above query will only work and provide license usage using _internal index. But the input is coming to different indexes.
But, we need to group the hosts by the _meta field and find the license usage of each group. Is it possible to calculate license usage using the _meta field added to every host in the configuration?