Splunk Search

Powershell: How to parse epoch stamped DB files for a specific date range and move those files to thaweddb?

jward6004
Explorer

I'm trying to automate a task for moving db files from a specified date range to the thaweddb so that my teams can search this data even after the normal data retention limits have been reached. Our company does a lot of business over holiday periods, i.e. the week of Christmas, Valentine's Day, etc. and we need to be able to compare trends from past holidays. Since the db files are epoch date and time stamped, the script will need to be able to sparse the db directory reading epoch time looking for the specified date range and then once it identifies those files, move them to thaweddb. Has anyone tried to do anything similar to this that might be able to give me some hints on how to piece this together? Thanks in advance!

0 Karma

richgalloway
SplunkTrust
SplunkTrust

db directory names are in the format db_<startTime>_<endTime>_n. Start and end times are in epoch format, which is the number of seconds since 12/31/69 23:59:59. You should be able to find some code on-line to convert the epoch timestamps into Windows time or whatever else your script needs.

---
If this reply helps you, Karma would be appreciated.
0 Karma

jward6004
Explorer

@richgalloway, thanks I've already found docs online to use powershell to convert epoch to regular time such as this :

http://stackoverflow.com/questions/10781697/convert-unix-time-with-powershell

However, I'm trying to figure out the structure and parse portions of the intended script.

0 Karma

richgalloway
SplunkTrust
SplunkTrust

I don't know enough about powershell to help with that part. Sorry.

---
If this reply helps you, Karma would be appreciated.
0 Karma
Get Updates on the Splunk Community!

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Get the T-shirt to Prove You Survived Splunk University Bootcamp

As if Splunk University, in Las Vegas, in-person, with three days of bootcamps and labs weren’t enough, now ...

Wondering How to Build Resiliency in the Cloud?

IT leaders are choosing Splunk Cloud as an ideal cloud transformation platform to drive business resilience,  ...