Script that calls ausearch behaves differently when piped data on stdin

前端 未结 2 2050
一整个雨季
一整个雨季 2021-01-15 17:59

Can someone explain why passing a bash script data via STDIN would cause the command within the script to NOT function?

Script:

#!/bin/bash
ausearch          


        
2条回答
  •  难免孤独
    2021-01-15 18:15

    ausearch changes its behavior if stdin is a pipe. If it is it searches through stdin rather than through the audit daemon logs. You can use --input-logs to force it to read from the logs.

    echo "blah" | ausearch -i -a 1221217 --input-logs
    

    Redirecting stdin would achieve the same end.

    #!/bin/bash
    ausearch -i -a 1221217 < /dev/null
    

提交回复
热议问题