Getting Data In

How to edit ps.sh to limit process getting in ingest for Splunk Add-on for Unix and Linux

tgmvt03
Engager

Hello,
I'm trying to only get a certain server processes to ingest to splunk index using Splunk Add-on for Unix and Linux script by editing the ps.sh script by adding grep command in there. like below.
However i'm getting error like
ERROR: Unsupported option (BSD syntax)
or
ERROR: Garbage option.

edit:
CMD='ps auxww|grep nc'

Could someone please direct me to document how to add grep in or some guidance how to get this ps.sh script to works?

thank you

Tags (2)
0 Karma
1 Solution

renjith_nair
SplunkTrust
SplunkTrust

@tgmvt03 ,

Depending on your OS version, you could add the list of commands (process names) to be displayed using -C. Grep will remove the headers also which is used in final output

For e.g. for common Linux version, change the command

from

CMD='ps -wweo uname,pid,psr,pcpu,cputime,pmem,rsz,vsz,tty,s,etime,args'

to

CMD='ps -wwo uname,pid,psr,pcpu,cputime,pmem,rsz,vsz,tty,s,etime,args -C splunkd'

Two main differences :

  • Removed e from the command which is for selecting all processes.
  • Added -C with the command list - here for example splunkd

Have a look at ps man page

Happy Splunking!

View solution in original post

0 Karma

renjith_nair
SplunkTrust
SplunkTrust

@tgmvt03 ,

Depending on your OS version, you could add the list of commands (process names) to be displayed using -C. Grep will remove the headers also which is used in final output

For e.g. for common Linux version, change the command

from

CMD='ps -wweo uname,pid,psr,pcpu,cputime,pmem,rsz,vsz,tty,s,etime,args'

to

CMD='ps -wwo uname,pid,psr,pcpu,cputime,pmem,rsz,vsz,tty,s,etime,args -C splunkd'

Two main differences :

  • Removed e from the command which is for selecting all processes.
  • Added -C with the command list - here for example splunkd

Have a look at ps man page

Happy Splunking!
0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...