| 62 | } |
| 63 | |
| 64 | func (s *Spec) SetDefaults() { |
| 65 | if !strings.Contains(s.Path, varTable) { |
| 66 | s.Path = path.Join(s.Path, fmt.Sprintf("%s.%s", varTable, s.Format)) |
| 67 | } |
| 68 | if s.BatchSize == nil { |
| 69 | if s.NoRotate { |
| 70 | s.BatchSize = ptr(int64(0)) |
| 71 | } else { |
| 72 | s.BatchSize = ptr(int64(10000)) |
| 73 | } |
| 74 | } |
| 75 | if s.BatchSizeBytes == nil { |
| 76 | if s.NoRotate { |
| 77 | s.BatchSizeBytes = ptr(int64(0)) |
| 78 | } else { |
| 79 | s.BatchSizeBytes = ptr(int64(50 * 1024 * 1024)) // 50 MiB |
| 80 | } |
| 81 | } |
| 82 | if s.BatchTimeout == nil { |
| 83 | if s.NoRotate { |
| 84 | d := configtype.NewDuration(0) |
| 85 | s.BatchTimeout = &d |
| 86 | } else { |
| 87 | d := configtype.NewDuration(30 * time.Second) |
| 88 | s.BatchTimeout = &d |
| 89 | } |
| 90 | } |
| 91 | } |
| 92 | |
| 93 | func (s *Spec) Validate() error { |
| 94 | if len(s.Path) == 0 { |