See if this works:
| multisearch
[search index=d2i sourcetype=D2I_Fichesconsolidees typ_stat=*_TOTAL | rename counter as total_count]
[search index=d2i sourcetype=D2I_Fichesconsolidees typ_stat=*_PERMIS | rename counter as perm_count]
| stats sum(total_count) as total_count sum(perm_count) as perm_count by type_fiche
Note, you need to use the different "e" in Ficheconsolidees as I dont have this "e" on my keyboard.
Even better though:
index=d2i sourcetype=D2I_Fichesconsolidees (typ_stat=*_TOTAL OR typ_stat=*PERMIS)
| eval total_count=if(typ_stat=*_TOTAL,counter,null())
| eval perm_count=if(typ_stat=*_PERMIS,counter,null())
| stats sum(total_count) as total_count sum(perm_count) as perm_count by type_fiche
"Error in 'eval' command: Regex: nothing to repeat"
Take a look at the like and match functions in the Search Reference documentation, you should probably be able to use either to accomplish the solution proposed by jkat54.
I could attempt a solution, but you won't be learning anything that way. If you are still having problems having read the documentation, post the searches you've tried and how they're failing to produce the desired results. If you are successful it would be nice to see the query you decided to use.
Dave
Thanks Dave, anyway I've already got a solution provided by Michael.
My comment was referring to the "Error in 'eval' command: Regex: nothing to repeat" message. If you have a solution that matches your needs then Happy Splunking.
Dave
See if this works:
| multisearch
[search index=d2i sourcetype=D2I_Fichesconsolidees typ_stat=*_TOTAL | rename counter as total_count]
[search index=d2i sourcetype=D2I_Fichesconsolidees typ_stat=*_PERMIS | rename counter as perm_count]
| stats sum(total_count) as total_count sum(perm_count) as perm_count by type_fiche
Note, you need to use the different "e" in Ficheconsolidees as I dont have this "e" on my keyboard.
Even better though:
index=d2i sourcetype=D2I_Fichesconsolidees (typ_stat=*_TOTAL OR typ_stat=*PERMIS)
| eval total_count=if(typ_stat=*_TOTAL,counter,null())
| eval perm_count=if(typ_stat=*_PERMIS,counter,null())
| stats sum(total_count) as total_count sum(perm_count) as perm_count by type_fiche
| multisearch
[search index=d2i sourcetype=D2I_Fichesconsolidées typ_stat=_TOTAL | rename counter as total_count]
[search index=d2i sourcetype=D2I_Fichesconsolidées typ_stat=_PERMIS | rename counter as perm_count]
| stats sum(total_count) as total_count sum(perm_count) as perm_count by typ_fiche
Dear Michael, first search worked (just a mistake at 'typ_fiche'), thanks a lot!
Second search was giving an error at eval :
Error in 'eval' command: The expression is malformed. An unexpected character is reached at '*_TOTAL,counter,null())'.
OK great, but you want to run just one search for this as it is more efficient, uses less cpu, memory, etc. Try this too please:
index=d2i sourcetype=D2I_Fichesconsolidees (typ_stat=*_TOTAL OR typ_stat=*PERMIS)
| eval total_count=if(match(typ_stat,"*_TOTAL"),counter,null())
| eval perm_count=if(match(typ_stat,"*_PERMIS"),counter,null())
| stats sum(total_count) as total_count sum(perm_count) as perm_count by typ_fiche