Splunk Enterprise

In Splunk, I am trying to index data from sql server table, but not able to add data to index

nilesh_warwatka
New Member

Hi

Issue: I am trying to index data from sql server, but not able to add data to index.

In splunk I am able to fetch sql server data using “SQL Explorer” and “dbquery”.

To index sqlserver data with splunk, I created “Input” by passing appropriate parameters, but it did not work for me.

Application: Splunk DB Connect 3.0.3 (on Linux server)

Please provide your inputs

Entries with db_inputs.conf file, I also tried to add data to default index as well as custom index. But did not get any success.

[Input_db_log]
connection = Logging
fetch_size = 100
index = idxmssql
input_timestamp_column_fullname = (002) Log.Date.datetime
input_timestamp_column_name = Date
interval = */3 * * * *
max_rows = 1000
mode = advanced
query = SELECT * FROM "Sitecore.Logging"."dbo"."Log"  where id > ? order by id
sourcetype = dbx
tail_rising_column_name = ID
ui_query_catalog = Sitecore.Logging
ui_query_mode = advanced
ui_query_schema = dbo
ui_query_table = Log
Tags (1)
0 Karma

newbie2tech
Communicator

Can you check below things

1) Run the query from the db connect ui to see it goes through fine

2) Make sure ID is not alphanumeric and is unique and is incremental

3) can you hardcode the id to start off with for example id>1234 such that intial load knows where to start from and then it takes off from there

4) Once the schedule run is complete, look for data in the index for "All Time" , as it is possible that the events are back dated depending on which column is being treated as event date

5) Make sure you have date column available in the table, if you already have an date column which you would want to use as event date, make that column as the first column( select a.modify_time as event_date , a.* from table1 a where id>1234) , if you do not have date column you may use currentimestamp as event_date, I would call it out explicitly though I know splunk would use upload time as event date just to make sure no other column is playing spoilsport.

6) none of these work, then check you error logs and debug options as suggested by Dave.

0 Karma

davebrooking
Contributor

Have you checked the DB Connect logs for instances of your query being scheduled? You may need to change the logging level to DEBUG to get additional diagnostics.

Dave

0 Karma

davebrooking
Contributor

Should the query attribute be

query = SELECT * FROM "Sitecore.Logging"."dbo"."Log" where id > ? order by id

in your statement you haven't specified which columns you want to select

Dave

0 Karma

nilesh_warwatka
New Member

" * " represents all the Column from the table , i need all the columns from table.
Note : i have specify each column name manually in query ?
Please correct me if I am missing any thing...

0 Karma

woodcock
Esteemed Legend

That was formatting error; fixed now.

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

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...