Getting Data In

passing source script file name in another field before indexing

DataOrg
Builder

i have a script which will be executed from inputs.conf but i need the script file name in a new field instead of source tag.
since i have a default source name configured. i want to add script file(source script) Name to the data indexed in the new field.

[script:///$SPLUNK_HOME/etc/apps/KIO/bin/Stats.py]
    interval = * * * * *
    source = siebel
    sourcetype = inflowstats
    disabled = False 
    index = index1
    host=server1
    Script=ScriptName
0 Karma

harsmarvania57
Ultra Champion
0 Karma

to4kawa
Ultra Champion

how about ingest_eval or DEST_KEY in transforms.conf?

0 Karma

DataOrg
Builder

@to4kawa is it possible to hardcode the value ? to any new field

0 Karma

to4kawa
Ultra Champion

I don't know hardcode .
the field value is indexed as new value by settings.

0 Karma

DataOrg
Builder

@to4kawa how to do it new field creation with static value at transform.conf

0 Karma

to4kawa
Ultra Champion

https://answers.splunk.com/answers/817188/add-x-hours-to-epoch-time.html#answer-817198

this answer express to change source field value. it can create another field, also.

0 Karma

DataOrg
Builder

@to4kawa I tried this and not getting any results.

transforms.conf
 [myeval]
 INGEST_EVAL = ScriptName=python_script

 props.conf
 [testLog]
 TRANSFORMS = myeval

fields.conf
 [eval_city]
 INDEXED = True
0 Karma

to4kawa
Ultra Champion

INGEST_EVAL is eval
use "
and in props.conf, class name is needed.

0 Karma

DataOrg
Builder

@to4kawa is this correct to extract from source? i want to extract the file name alone. i want regex for this. please help

[extract-source]
SOURCE_KEY = MetaData:Source
FORMAT = job_id::$2
WRITE_META = true

source path will be etc/apps/bin/python.py

0 Karma

to4kawa
Ultra Champion

what's $2?
where's REGEX?

0 Karma

DataOrg
Builder

worked by adding default value in inputs.conf directly.
[script://path/your_script.py]
_meta = script_name::abc.py

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Tech Talk Recap | Mastering Threat Hunting

Mastering Threat HuntingDive into the world of threat hunting, exploring the key differences between ...

Observability for AI Applications: Troubleshooting Latency

If you’re working with proprietary company data, you’re probably going to have a locally hosted LLM or many ...

Splunk AI Assistant for SPL vs. ChatGPT: Which One is Better?

In the age of AI, every tool promises to make our lives easier. From summarizing content to writing code, ...