puppetlabs / support-script-tooling

3 stars 5 forks source link

Limit analysis to specific time bracket - puppet-top-api-calls.sh #4

Open jordi-garcia opened 3 years ago

jordi-garcia commented 3 years ago

Use Case

At present the script parses the full file, we may be interested on a subset of time e.g. 30 min

Describe the Solution You Would Like

when starting the script, one could be provided with the initial time stamp and asked if they want that to use that time as the starting time. If not, user could be asked the starting time. Then, user could be presented with a required duration for the analysis (e.g. full file, 30 min or some other answer in minutes.

Describe Alternatives You've Considered

One could create a separate file with the subset of lines for analysis but you run in file name restrictions there to remember e.g. log file needs to be name as puppetserver-access* or puppetdb-access* and if you need to make modifications in time then one would be creating 2/3/4 files with the different time sections involved

Additional Context

As a suggestion, it may be interesting to ask user for the type of file to analyse e.g.

Press 1 for `puppetserver-access` log, 
Press 2 for `puppetdb-access` log

and manage the relevant code based on a case statement on the back of the answer provided. This may be more useful as additional log files are added to this script.