code: func addFieldsToEvent(fields map[string]string, ev *event.Event) {
  	for k, v := range fields {
  		// Try to convert values to integer types where sensible, and extract
  		// timestamp for event
  		switch k {
  		case "session_id", "pid", "session_line_number":
  			if typed, err := strconv.Atoi(v); err == nil {
  				ev.Data[k] = typed
  			} else {
  				ev.Data[k] = v
  			}
  		case "timestamp", "timestamp_millis":
  			if timestamp, err := time.Parse("2006-01-02 15:04:05.999 MST", v); err == nil {
  				ev.Timestamp = timestamp
  			} else {
  				logrus.WithField("timestamp", v).WithError(err).Debug("Error parsing query timestamp")
  			}
  		case "timestamp_unix":
  			if typed, err := strconv.Atoi(v); err == nil {
  				// Convert millisecond-resolution Unix timestamp to time.Time
  				// object
  				timestamp := time.Unix(int64(typed/1000), int64((1000*1000)*(typed%1000))).UTC()
  				ev.Timestamp = timestamp
  			} else {
  				logrus.WithField("timestamp", v).WithError(err).Debug("Error parsing query timestamp")
  			}
  		default:
  			ev.Data[k] = v
  		}
  	}
  }
docs: // addFieldsToEvent takes a map of key-value metadata extracted from a log
  // line, and adds them to the given event. It'll convert values to integer
  // types where possible, and try to populate the event's timestamp.