func (f logEventFormatter) jmespathQuery(s string, query jmespath.JMESPath) string {
	var data interface{}
	err := json.Unmarshal([]byte(s), &data)
	result, err := query.Search(data)
	if err != nil {
		f.Log.Printf("Failed query using jmespathQuery: Error: %v\n", err)
		return s
	}
	if result == nil {
		return fmt.Sprintf("<cw: empty jmesPath query result> %s", s)
	}
	searchResult, err := json.Marshal(result)
	if err != nil {
		f.Log.Printf("Failed to marshall jmespathQuery result to json: Error: %v\n", err)
		return s
	}
	return string(searchResult)
}
jmespathQuery returns a the stringified results of a pre-compiled JMESPath query
if the query fails, it will return the original string.
package main
import (
	"bufio"
	"encoding/json"
	"errors"
	"fmt"
	"io/ioutil"
	"log"
	"os"
	"regexp"
	"strconv"
	"strings"
	"sync"
	"time"
	"unicode"
	"github.com/alecthomas/kong"
	"github.com/aws/aws-sdk-go-v2/aws"
	"github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs"
	"github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs/types"
	"github.com/fatih/color"
	"github.com/jmespath/go-jmespath"
	"github.com/lucagrulla/cw/cloudwatch"
)
const (
	timeFormat = "2006-01-02T15:04:05"
	version    = "4.1.0"
)
func timestampToTime(timeStamp *string, local bool) (time.Time, error) {
	var zone *time.Location
	if local {
		zone = time.Local
	} else {
		zone = time.UTC
	}
	if regexp.MustCompile(`^\d{4}-\d{2}-\d{2}$`).MatchString(*timeStamp) {
		t, _ := time.ParseInLocation("2006-01-02", *timeStamp, zone)
		return t, nil
	} else if regexp.MustCompile(`^\d{4}-\d{2}-\d{2}T\d{2}$`).MatchString(*timeStamp) {
		t, _ := time.ParseInLocation("2006-01-02T15", *timeStamp, zone)
		return t, nil
	} else if regexp.MustCompile(`^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}$`).MatchString(*timeStamp) {
		t, _ := time.ParseInLocation("2006-01-02T15:04", *timeStamp, zone)
		return t, nil
	} else if regexp.MustCompile(`^\d{1,2}$`).MatchString(*timeStamp) {
		y, m, d := time.Now().In(zone).Date()
		t, _ := strconv.Atoi(*timeStamp)
		return time.Date(y, m, d, t, 0, 0, 0, zone), nil
	} else if res := regexp.MustCompile(`^(?P<Hour>\d{1,2}):(?P<Minute>\d{2})$`).FindStringSubmatch(*timeStamp); res != nil {
		y, m, d := time.Now().Date()
		t, _ := strconv.Atoi(res[1])
		mm, _ := strconv.Atoi(res[2])
		return time.Date(y, m, d, t, mm, 0, 0, zone), nil
	} else if res := regexp.MustCompile(
		`^(?:(?P<Day>\d{1,})(?:d))?(?P<HourMinute>(?:\d{1,}h)?(?:\d{1,}m)?)?$`).FindStringSubmatch(
		*timeStamp); res != nil {
		days, _ := strconv.Atoi(res[1])
		d, _ := time.ParseDuration(res[2])
		t := time.Now().In(zone).AddDate(0, 0, -days).Add(-d)
		y, m, dd := t.Date()
		return time.Date(y, m, dd, t.Hour(), t.Minute(), 0, 0, zone), nil
	}
	t, err := time.ParseInLocation("2006-01-02T15:04:05", *timeStamp, zone)
	if err != nil {
		return t, err
	}
	return t, nil
}
type logEvent struct {
	logEvent types.FilteredLogEvent
	logGroup string
}
type formatConfig struct {
	PrintTime       bool
	PrintStreamName bool
	PrintGroupName  bool
	PrintEventID    bool
	Query           *jmespath.JMESPath
}
type logEventFormatter struct {
	Log          *log.Logger
	FormatConfig formatConfig
}