@@ -205,7 +205,7 @@ func (sboadb *SBOAnalyticsDB) SaveRawLog(data *logparsers.SBOHttpRequestLog, dom
205205 data .Status , data .BytesSent ,
206206 ReduceToMaxColumnLen (data .Referer , 100 ),
207207 data .Malicious ,
208- ReduceToMaxColumnLen (data .UserAgent .FullName , 100 ),
208+ ReduceToMaxColumnLenKeepingLastPart (data .UserAgent .FullName , 100 ),
209209 ReduceToMaxColumnLen (data .UserAgent .OS , 20 ),
210210 ReduceToMaxColumnLen (data .UserAgent .Family , 20 ),
211211 ReduceToMaxColumnLen (data .UserAgent .DeviceType , 20 ),
@@ -229,6 +229,14 @@ func ReduceToMaxColumnLen(str string, colSize int) string {
229229 return str [:colSize ]
230230}
231231
232+ func ReduceToMaxColumnLenKeepingLastPart (str string , colSize int ) string {
233+ if len (str ) <= colSize {
234+ return str
235+ }
236+ //TODO assuming ASCII, add unicode support
237+ return str [(len (str ) - colSize ):]
238+ }
239+
232240func (sboadb * SBOAnalyticsDB ) SaveOSMetrics (uptimeInfo * metrics.UptimeInfo , memoryInfo * metrics.MemoryInfo , hostId int ) (bool , error ) {
233241 var sql string = "INSERT INTO sbo_os_metrics (host_id, metrics_ts, up_duration_minutes, users, " +
234242 " load_average1, load_average5, load_average15, " +
0 commit comments