Knowledge Management

I would like to create a new index with some extract fields which are not in my initial index

isachristophe
New Member

Hello

Topic: I would like to create a new index with some extract fields which are not in my initial index

Description :
I have an index and I create new fields with a python script
index "A"
name
last_name
otherinformation

search : index="A" | script python extractname
name last_name adress zipcode

What I need ?

I would like create a new index with all the columns .
search : index="A" | script python extractname | table * | collect index="B"

but in my new index I just see name last_name otherinformation

Have you an idea ?

0 Karma
1 Solution

micahkemp
Champion

If your event as _raw when piped to collect that value will be used as the full event for your summary.

You should specify only the fields you care about with table before you run collect:

index=A | script python extractname | table name last_name address zipcode | collect index=B

You could use table * | fields - _raw to remove only _raw from your results, but I strongly recommend specifying the full set of fields you actually want to be present in your summary index instead.

View solution in original post

0 Karma

micahkemp
Champion

If your event as _raw when piped to collect that value will be used as the full event for your summary.

You should specify only the fields you care about with table before you run collect:

index=A | script python extractname | table name last_name address zipcode | collect index=B

You could use table * | fields - _raw to remove only _raw from your results, but I strongly recommend specifying the full set of fields you actually want to be present in your summary index instead.

0 Karma

isachristophe
New Member

Thanks a lot.

It is working with table * | fields - _raw

0 Karma

micahkemp
Champion

Excellent. Please accept the answer so that this question doesn't still appear to be open.

And again, I strongly suggest you use fields <list of fields you definitely want> instead of just removing _raw. But I obviously don't know your entire use case.

0 Karma

isachristophe
New Member

I have in index B exactly the _raw of index A and not the columns that I had after the extraction

0 Karma

micahkemp
Champion

Can you include the output of index="A" | script python extractname | table *, and the output of index="B"?

0 Karma
Get Updates on the Splunk Community!

Build Scalable Security While Moving to Cloud - Guide From Clayton Homes

 Clayton Homes faced the increased challenge of strengthening their security posture as they went through ...

Mission Control | Explore the latest release of Splunk Mission Control (2.3)

We’re happy to announce the release of Mission Control 2.3 which includes several new and exciting features ...

Cloud Platform | Migrating your Splunk Cloud deployment to Python 3.7

Python 2.7, the last release of Python 2, reached End of Life back on January 1, 2020. As part of our larger ...