It looks like |mcollect is just a custom command to create metrics.csv files. The metrics documentation on importing .csv files makes no mention of how to add a custom "host" field to your .csv file. Everytime I have used .csv for metrics the host value comes from inputs.conf.
It's not elegant, but I verified a custom host can be extracted with props/transforms. Since using a new sourcetype name incurs license usage I'm betting your can have props reference a custom source instead.
When Splunk writes the .csv from this |mcollect query to disk, it looks like this (I happened to have an "id" dimension in my results)
|mcollect index=index_name source=source_name sourcetype=new_mcollect_stash spool=false id host
==> /var/opt/splunk/var/run/splunk/c247f3132f17807a_metrics.csv <==
I copied the default "mcollect_stash" sourcetype to a new one for testing. The transforms extracts the 3rd column as the hostname.
SHOULD_LINEMERGE = False
pulldown_type = true
INDEXED_EXTRACTIONS = csv
ADD_EXTRA_TIME_FIELDS = False
KV_MODE = none
TRANSFORMS-newmetrichost = newmetrichost
TIMESTAMP_FIELDS = metric_timestamp
TIME_FORMAT = %s.%Q
DEST_KEY = MetaData:Host
REGEX = ^[^,]+,[^,]+,([^,]+)
FORMAT = host::$1
... View more