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 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...