github.com/axw/juju@v0.0.0-20161005053422-4bd6544d08d4/apiserver/params/logstream.go (about) 1 // Copyright 2016 Canonical Ltd. 2 // Licensed under the AGPLv3, see LICENCE file for details. 3 4 package params 5 6 import ( 7 "time" 8 ) 9 10 // LogStreamRecord contains a slice of LogStreamRecords. 11 type LogStreamRecords struct { 12 Records []LogStreamRecord `json:"records"` 13 } 14 15 // LogStreamRecord describes a single log record being streamed from 16 // the server. 17 type LogStreamRecord struct { 18 ID int64 `json:"id"` 19 ModelUUID string `json:"mid"` 20 Entity string `json:"ent"` 21 Version string `json:"ver,omitempty"` 22 Timestamp time.Time `json:"ts"` 23 Module string `json:"mod"` 24 Location string `json:"lo"` 25 Level string `json:"lv"` 26 Message string `json:"msg"` 27 } 28 29 // LogStreamConfig holds all the information necessary to open a 30 // streaming connection to the API endpoint for reading log records. 31 // 32 // The field tags relate to the following 2 libraries: 33 // github.com/google/go-querystring/query (encoding) 34 // github.com/gorilla/schema (decoding) 35 // 36 // See apiserver/debuglog.go:debugLogParams for additional things we 37 // may consider supporting here. 38 type LogStreamConfig struct { 39 // AllModels indicates whether logs for all the controller's models 40 // should be included or just those of the connection's model. 41 AllModels bool `schema:"all" url:"all,omitempty"` 42 43 // Sink identifies the target to which log records will be streamed. 44 // This is used as a bookmark for where to start the next time logs 45 // are streamed for the same sink. 46 Sink string `schema:"sink" url:"sink,omitempty"` 47 48 // MaxLookbackDuration is the maximum time duration from the past to stream. 49 // It must be a valid time duration string. 50 MaxLookbackDuration string `schema:"maxlookbackduration" url:"maxlookbackduration,omitempty"` 51 52 // MaxLookbackRecords is the maximum number of log records to stream from the past. 53 MaxLookbackRecords int `schema:"maxlookbackrecords" url:"maxlookbackrecords,omitempty"` 54 }