Splunk Search

Why are 2 of my 3 HiddenPostProcess searches returning zero results?

luxiaobin
Explorer

Hi, I'm using HiddenPostProcess. I made three HiddenPostProcess searches. The first returns the right number, but the others return 0. Can someone tell me what's wrong with my search? thx!

    <param name="search">index=idx_source=*xx*|where strftime(strptime(REGIST_TIME,"%s"),"%Y") = strftime(now(),"%Y")|where strftime(strptime(REGIST_TIME,"%s"),"%m") = strftime(now(),"%m")</param>
    <module name="HiddenPostProcess">
        <param name="search">|stats count</param>
        <module name="SingleValue">
            <param name="beforeLabel">共</param>
            <param name="format">number</param>
            <param name="afterLabel">人</param>
        </module>
    </module>
    <module name="HiddenPostProcess">
        <param name="search">|where GENDER=1|stats count</param>
        <module name="SingleValue">
            <param name="beforeLabel">女</param>
            <param name="format">number</param>
            <param name="afterLabel">人</param>
        </module>
    </module>
    <module name="HiddenPostProcess">
        <param name="search">|where GENDER=0|stats count</param>
        <module name="SingleValue">
            <param name="beforeLabel">男</param>
            <param name="format">number</param>
            <param name="afterLabel">人</param>
        </module>
    </module>
</module>
Tags (1)
0 Karma
1 Solution

luxiaobin
Explorer

DavidHourani
Super Champion

Are you sure you have the field GENDER ? if so, why not do a |stats count by GENDER just to be sure that you actually have something...Do that in the search that is working, then add |search GENDER=0to see what you get 🙂

0 Karma

ramdaspr
Contributor

I havent tried HiddenPostProcess in a module yet, so this is just a guess. Try using search instead of where

 <module name="HiddenPostProcess">
         <param name="search">| search GENDER=1|stats count</param>
0 Karma

luxiaobin
Explorer

it doesn`t work . anyway thx!

0 Karma
Get Updates on the Splunk Community!

[Puzzles] Solve, Learn, Repeat: Dynamic formatting from XML events

This challenge was first posted on Slack #puzzles channelFor a previous puzzle, I needed a set of fixed-length ...

Enter the Agentic Era with Splunk AI Assistant for SPL 1.4

  &#x1f680; Your data just got a serious AI upgrade — are you ready? Say hello to the Agentic Era with the ...

Stronger Security with Federated Search for S3, GCP SQL & Australian Threat ...

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...