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!

Detecting Remote Code Executions With the Splunk Threat Research Team

REGISTER NOWRemote code execution (RCE) vulnerabilities pose a significant risk to organizations. If ...

Observability | Use Synthetic Monitoring for Website Metadata Verification

If you are on Splunk Observability Cloud, you may already have Synthetic Monitoringin your observability ...

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...