Fork me on GitHub

{:field "@timestamp", :value "2022-02-16 03:00:23.196"} what is the best way to read this cloudwatch log timestamp?

AJ Jaro16:02:53

@U02CV2P4J6S Can you be more specific about what you’re asking? I’m not sure if you mean read it in a query in CloudWatch or some other utility. However, I’m pretty sure you don’t mean physically read it 😅

Drew Verlee04:02:56

@U02CV2P4J6S i'm going to take a guess at what you mean. The answer is using the AWS client-cloud-watch logs SDK, either java (clj) or javascript (node).

Drew Verlee04:02:43

for example here is me reading some logs:

(ns core3
  (:require [cljs.core.async :refer [go]]
            [cljs.core.async.interop :refer-macros [<p!]]
            [common.transit :as transit]
            [common.json :refer [json->clj]]
            ["@aws-sdk/client-cloudwatch-logs" :refer (CloudWatchLogsClient FilterLogEventsCommand)]
            [clojure.string :as str]
            [tick.alpha.api :as t]))

(def client (new CloudWatchLogsClient #js{:region "us-east-1"}))

(def command (new FilterLogEventsCommand #js{:logGroupName  "/aws/lambda/drew-dev-EqlRoute"
                                             :filterPattern "eql"
                                             :startTime 1644887463000
                                             :limit 100

(def r (atom nil))

    (reset! r
            (<p! (.send client command)))
    (catch js/Error err (js/console.log (str "err: " err)))))


@U0DJ4T5U1 thanks for the example