
// add log entries
2021.10.22 13:39:57.739	SendOrderByPlan (USDJPY,H4)	ChartMan::TakeScreenshot / Cayman/Screenshots/20211022/20211022_133955_USDJPY_H4_OrderPlaced.png

>seqcli log -t=2021-10-22T13:39:57.739 -p AppName=MQL5 Symbol=EURJPY Period=H4 Sender=SendOrderByPlan -m "ChartMan::TakeScreenshot / Cayman/Screenshots/20211022/20211022_133955_USDJPY_H4_OrderPlaced.png"
Unrecognized options: Symbol=EURJPY, Period=H4, Sender=SendOrderByPlan

>seqcli log -t=2021-10-22T13:39:57.739 -p AppName=MQL5,Symbol=EURJPY, Period=H4, Sender=SendOrderByPlan -m "ChartMan::TakeScreenshot / Cayman/Screenshots/20211022/20211022_133955_USDJPY_H4_OrderPlaced.png"
Unrecognized options: Period=H4,, Sender=SendOrderByPlan

>seqcli log -t=2021-10-22T13:39:57.739 -p AppName=MQL5 -p Symbol=EURJPY -p Period=H4 -p Sender=SendOrderByPlan -m "ChartMan::TakeScreenshot / Cayman/Screenshots/20211022/20211022_133955_USDJPY_H4_OrderPlaced.png"
OK

// select the last few records in json format
seqcli query -q "select * from stream order by Timestamp desc limit 3" --json > temp.json

// get the time of the last entry for AppName=MQL5
>seqcli query -q "select ToIsoString(@Timestamp) as Timestamp from stream where AppName = 'MQL5' order by Timestamp desc limit 1"
"Timestamp"
"2021-10-22T10:39:57.7390000Z"

// CLEF format to import logs to Seq => test.clef
{"@t":"2021-10-22T13:39:57.739","AppName":"MQL5", "Symbol":"EURJPY", "Period":"H4","Sender":"SendOrderByPlan","@m":"раз ChartMan::TakeScreenshot / Cayman/Screenshots/20211022/20211022_133955_USDJPY_H4_OrderPlaced.png"}
{"@t":"2021-10-22T13:39:57.740","AppName":"MQL5", "Symbol":"EURJPY", "Period":"H4","Sender":"SendOrderByPlan","@m":"два ChartMan::TakeScreenshot / Cayman/Screenshots/20211022/20211022_133955_USDJPY_H4_OrderPlaced.png"}

// import test.clef to seq
seqcli ingest -i test.clef --json

// 
select 
    Substring(ToIsoString(@Timestamp), 0, 23) as Timestamp, 
    Symbol, Period, Sender, @Message
from stream
where AppName = 'MQL5' and Symbol = 'EURJPY' and Period = 'H4'

select 
    ToIsoString(@Timestamp) as Timestamp,  @Level,
    ToHexString(@EventType) as EventType,  @Message, @Exception, @Properties
from stream
order by Timestamp desc
limit 10

select 
   ToIsoString(@Timestamp) as Timestamp, 
   @Message 
from stream 
where AppName = 'MQL5'
order by Timestamp desc
limit 1

select *
from stream
where AppName = 'MQL5' and Symbol = 'EURJPY' and Period = 'H4'

