I am trying to composing a Splunk query by fetching the values from the text file content. Here i dont want to use any Splunk modules/libraries.
This is my simple code -
import pandas as pd
from pandas import ExcelWriter
from pandas import ExcelFile
import sys
df = pd.read_excel("I:\\splunk_dashboards\\FID_list.xlsx", sheetname='FID_lastweek')
sys.stdout = open("I:\\splunk_dashboards\\FID.txt", "w")
v = df['FID']
#print(df['FID'])
print(v)
This is the simple code where it retrieves the particular column values and store it in a text file.
The next step is to form a splunk query with the results stored in the text file.
For example below is the result from the text file -
0 CollectionLimitsValidation
1 PaymentLimitsValidation
2 AccountDetailsFacadeBean
3 AccountDetailsFacadeBean
I do have a splunk query like below in another text file -
index=hfc_new_98764 host=QA FID=$(Value1_from_text_file) OR FID=$(value2_from _text_file) OR.... it goes on upto the final values
From the above template i need a splunk query like below -
index=hfc_new_98764 host=QA FID=CollectionLimitsValidation OR FID=PaymentLimitsValidation OR FID=.... it goes on upto the final values
I need help to iterate the values from the text file and to store in the template file file.