I am using wazuh and I want to monitor Linux processes more specifically I want to alert the start of any new process is that doable?
at first i tried to make a rule in wazuh that will tell me if any program started
<local_rules>
<group name="syslog,">
<rule id="9999" level="10">
<program_name>.*</program_name>
<source_name>syslog</source_name>
<option name="description" value="Process monitoring rule." />
</rule>
</group>
i m not sure if the sourcename tag is correct plus i just want to alert the strat on processes and not services so i tried this bash script
#!/bin/bash
file1="$2"
file2="$1"
while IFS= read -r line; do
grep -q "$line" "$file2" || echo "New process ID was found: $line"
done < "$file1"
#!/bin/bash
while true; do
# Create new f1.txt file
ps -e | awk '{print $1, $4}' > f1.txt
# Compare f1.txt with last f2.txt file
if [ -f f2.txt ]; then
sh comp.sh f1.txt f2.txt >> result.txt
fi
# Rename f1.txt to f2.txt
mv f1.txt f2.txt
# Sleep for 1 second
sleep 1
done
but when i use it it detects the processes that started because of the script itself and i don't know what to do now to solve this