-
Notifications
You must be signed in to change notification settings - Fork 122
/
Copy pathIndex.java
1118 lines (1019 loc) · 36.6 KB
/
Index.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* Copyright 2012 Splunk, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"): you may
* not use this file except in compliance with the License. You may obtain
* a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/
package com.splunk;
import java.io.IOException;
import java.io.OutputStream;
import java.net.Socket;
import java.util.Date;
/**
* The {@code Index} class represents an index.
*/
public class Index extends Entity {
/**
* Class constructor.
*
* @param service The connected {@code Service} instance.
* @param path The index endpoint.
*/
Index(Service service, String path) {
super(service, path);
}
/**
* Creates a writable socket to this index.
*
* @return The writable socket.
* @throws IOException Throws exception if fails to write socket.
*/
public Socket attach() throws IOException {
Receiver receiver = service.getReceiver();
return receiver.attach(getName());
}
/**
* Writes events to this index, reusing the connection.
* This method passes an output stream connected to the index to the
* {@code run} method of the {@code ReceiverBehavior} object, then handles
* setting up and tearing down the socket.
* <p>
* For an example of how to use this method, see
* <a href="http://dev.splunk.com/view/SP-CAAAEJ2" target="_blank">How to
* get data into Splunk</a> on
* <a href="http://dev.splunk.com/view/SP-CAAAEJ2"
* target="_blank">dev.splunk.com</a>.
*
* @param behavior The body of a {@code try} block as an anonymous
* implementation of the {@code ReceiverBehavior} interface.
* @throws IOException The IOException class
*/
public void attachWith(ReceiverBehavior behavior) throws IOException {
Socket socket = null;
OutputStream output = null;
try {
socket = attach();
output = socket.getOutputStream();
behavior.run(output);
output.flush();
} finally {
if (output != null) { output.close(); }
if (socket != null) { socket.close(); }
}
}
/**
* Creates a writable socket to this index.
*
* @param args Optional arguments for this stream. Valid parameters are:
* "host", "host_regex", "source", and "sourcetype".
* @return The socket.
* @throws IOException The IOException class
*/
public Socket attach(Args args) throws IOException {
Receiver receiver = service.getReceiver();
return receiver.attach(getName(), args);
}
/**
* Cleans this index, which removes all events from it.
*
* @param maxSeconds The maximum number of seconds to wait before returning.
* A value of -1 means to wait forever.
* @throws SplunkException If cleaning timed out or
* if the thread was interrupted.
* @return This index.
*/
public Index clean(int maxSeconds) {
Args saved = new Args();
saved.put("maxTotalDataSizeMB", getMaxTotalDataSizeMB());
saved.put("frozenTimePeriodInSecs", getFrozenTimePeriodInSecs());
try {
Args reset = new Args();
reset.put("maxTotalDataSizeMB", "1");
reset.put("frozenTimePeriodInSecs", "1");
update(reset);
rollHotBuckets();
long startTime = System.currentTimeMillis();
long endTime = startTime + (maxSeconds * 1000);
while (true) {
long timeLeft = endTime - System.currentTimeMillis();
if (timeLeft <= 0) {
break;
}
Thread.sleep(Math.min(1000, timeLeft));
if (this.getTotalEventCount() == 0) {
return this;
}
refresh();
}
throw new SplunkException(SplunkException.TIMEOUT,
"Index cleaning timed out");
}
catch (InterruptedException e)
{
SplunkException f = new SplunkException(
SplunkException.INTERRUPTED,
"Index cleaning interrupted.");
f.initCause(e);
throw f;
}
finally {
update(saved);
}
}
/**
* Indicates whether the data retrieved from this index has been
* UTF8-encoded.
*
* @return {@code true} if the retrieved data is in UTF8, {@code false} if
* not.
*/
public boolean getAssureUTF8() {
return getBoolean("assureUTF8");
}
/**
* Returns the total size of all bloom filter files.
*
* @return The total size of all bloom filter files, in KB.
*/
public int getBloomfilterTotalSizeKB() {
return getInteger("bloomfilterTotalSizeKB", 0);
}
/**
* Returns the suggested size of the .tsidx file for the bucket rebuild
* process.
* Valid values are: "auto", a positive integer, or a positive
* integer followed by "KB", "MB", or "GB".
*
* @return The suggested size of the .tsidx file for the bucket rebuild
* process.
*/
public String getBucketRebuildMemoryHint() {
return getString("bucketRebuildMemoryHint");
}
/**
* Returns the absolute file path to the cold database for this index.
* This value may contain shell expansion terms.
*
* @return The absolute file path to the cold database, or {@code null} if
* not specified.
*/
public String getColdPath() {
return getString("coldPath", null);
}
/**
* Returns the expanded absolute file path to the cold database for this
* index.
*
* @return The expanded absolute file path to the cold database, or
* {@code null} if not specified.
*/
public String getColdPathExpanded() {
return getString("coldPath_expanded", null);
}
/**
* Returns the frozen archive destination path for this index.
*
* @return The frozen archive destination path, or {@code null} if not
* specified.
*/
public String getColdToFrozenDir() {
return getString("coldToFrozenDir", null);
}
/**
* Returns the path to the archiving script.
* <p>For more info about archiving scripts, see the
* <a href="http://docs.splunk.com/Documentation/Splunk/latest/RESTAPI/RESTindex#POST_data.2Findexes"
* target="_blank">POST data/indexes endpoint</a> in the REST API
* documentation.
* @see #getColdToFrozenDir
*
* @return The archiving script, or {@code null} if not specified.
*/
public String getColdToFrozenScript() {
return getString("coldToFrozenScript", null);
}
/**
* Indicates whether raw data is compressed.
*
* @deprecated Splunk always compresses raw data.
* @return {@code true} if raw data is compressed, {@code false} if not.
*/
public boolean getCompressRawdata() {
return getBoolean("compressRawdata");
}
/**
* Returns the current size of this index.
*
* @return The current size of the index, in MB.
*/
public int getCurrentDBSizeMB() {
return getInteger("currentDBSizeMB");
}
/**
* Return the default index name of the Splunk instance.
*
* @return The default index name.
*/
public String getDefaultDatabase() {
return getString("defaultDatabase");
}
/**
* Returns whether asynchronous "online fsck" bucket repair is enabled.
* <p>
* When this feature is enabled, you don't have to wait for buckets to be
* repaired before starting Splunk, but you might notice a slight
* degradation in performance as a result.
* @return {@code true} if bucket repair is enabled, {@code false} if
* not.
*/
public boolean getEnableOnlineBucketRepair() {
return getBoolean("enableOnlineBucketRepair");
}
/**
* Indicates whether real-time search is enabled for this index.
*
* @return {@code true} if real-time search is enabled, {@code false} if
* not.
*/
public boolean getEnableRealtimeSearch() {
return getBoolean("enableRealtimeSearch");
}
/**
* Returns the maximum age for a bucket, after which the data in this index
* rolls to frozen. If archiving is necessary for frozen data, see the
* {@code coldToFrozen} attributes.
*
* @return The maximum age, in seconds, after which data rolls to frozen.
*/
public int getFrozenTimePeriodInSecs() {
return getInteger("frozenTimePeriodInSecs");
}
/**
* Returns the absolute path to both hot and warm buckets for this index.
* This value may contain shell expansion terms.
*
* @return This index's absolute path to both hot and warm buckets, or
* {@code null} if not specified.
*/
public String getHomePath() {
return getString("homePath", null);
}
/**
* Returns the expanded absolute path to both hot and warm buckets for this
* index.
*
* @return The expanded absolute path to both hot and warm buckets, or
* {@code null} if not specified.
*/
public String getHomePathExpanded() {
return getString("homePath_expanded", null);
}
/**
* Returns the index thread for this index.
*
* @return The index thread.
*/
public String getIndexThreads() {
return getString("indexThreads");
}
/**
* Returns the last initialization time for this index.
*
* @return The last initialization time, or {@code null} if not specified.
*/
public String getLastInitTime() {
return getString("lastInitTime", null);
}
/**
* Returns the time that indicates a bucket age. When a warm or cold bucket
* is older than this, Splunk does not create or rebuild its bloomfilter.
* The valid format is <i>number</i> followed by a time unit ("s", "m", "h",
* or "d"). For example, "30d" for 30 days.
* @return String value
*/
public String getMaxBloomBackfillBucketAge() {
return getString("maxBloomBackfillBucketAge", null);
}
/**
* Returns the maximum number of concurrent optimize processes that
* can run against a hot bucket for this index.
*
* @return The maximum number of concurrent optimize processes.
*/
public int getMaxConcurrentOptimizes() {
return getInteger("maxConcurrentOptimizes");
}
/**
* Returns the maximum data size before triggering a roll from hot to warm
* buckets for this index.
*
* @return The maximum data size, in MB, or "auto" (which means 750MB), or
* "auto_high_volume" (which means 10GB on a 64-bit system, or 1GB on a
* 32-bit system).
* @see #setMaxDataSize
*/
public String getMaxDataSize() {
return getString("maxDataSize");
}
/**
* Returns the maximum number of hot buckets that can exist for this index.
*
* @return The maximum number of hot buckets or "auto" (which means 3).
*/
public String getMaxHotBuckets() {
return getString("maxHotBuckets");
}
/**
* Returns the maximum lifetime of a hot bucket for this index.
* If a hot bucket exceeds this value, Splunk rolls it to warm.
* A value of 0 means an infinite lifetime.
*
* @return The hot bucket's maximum lifetime, in seconds.
*/
public int getMaxHotIdleSecs() {
return getInteger("maxHotIdleSecs");
}
/**
* Returns the upper bound of the target maximum timespan of
* hot and warm buckets for this index.
*
* @return The upper bound of the target maximum timespan, in seconds.
*/
public int getMaxHotSpanSecs() {
return getInteger("maxHotSpanSecs");
}
/**
* Returns the amount of memory to allocate for buffering
* a single .tsidx file into memory before flushing to disk.
*
* @return The amount of memory, in MB.
*/
public int getMaxMemMB() {
return getInteger("maxMemMB");
}
/**
* Returns the maximum number of unique lines that are allowed
* in a bucket's .data files for this index. A value of 0 means infinite
* lines.
*
* @return The maximum number of unique lines.
*/
public int getMaxMetaEntries() {
return getInteger("maxMetaEntries");
}
/**
* Returns the maximum number of concurrent helper processes for this index.
*
* @return The maximum number of concurrent helper processes.
*/
public int getMaxRunningProcessGroups() {
return getInteger("maxRunningProcessGroups", 0);
}
/**
* Returns the maximum time attribute for this index.
*
* @return The maximum time attribute, or {@code null} if not specified.
*/
public Date getMaxTime() {
return getDate("maxTime", null);
}
/**
* Returns the maximum size of this index. If an index
* grows larger than this value, the oldest data is frozen.
*
* @return The maximum index size, in MB.
*/
public int getMaxTotalDataSizeMB() {
return getInteger("maxTotalDataSizeMB");
}
/**
* Returns the upper limit, in seconds, for how long an event can sit in a
* raw slice. This value applies only when replication is enabled for this
* index, and is ignored otherwise.<br>
* If there are any acknowledged events sharing this raw slice, the
* {@code MaxTimeUnreplicatedWithAcksparamater} applies instead.
* @see #getMaxTimeUnreplicatedWithAcks
* @return int value
*/
public int getMaxTimeUnreplicatedNoAcks() {
return getInteger("maxTimeUnreplicatedNoAcks");
}
/**
* Returns the upper limit, in seconds, for how long an event can sit
* unacknowledged in a raw slice. This value only applies when indexer
* acknowledgement is enabled on forwarders and replication is enabled with
* clustering.
* @return int value
*/
public int getMaxTimeUnreplicatedWithAcks() {
return getInteger("maxTimeUnreplicatedWithAcks");
}
/**
* Returns the maximum number of warm buckets for this index. If this
* value is exceeded, the warm buckets with the lowest value for their
* latest times are moved to cold.
*
* @return The maximum number of warm buckets.
*/
public int getMaxWarmDBCount() {
return getInteger("maxWarmDBCount");
}
/**
* Returns the memory pool for this index.
*
* @return The memory pool, in MB or "auto".
*/
public String getMemPoolMB() {
return getString("memPoolMB");
}
/**
* Returns the frequency at which Splunkd forces a filesystem sync while
* compressing journal slices for this index.
* <p>
* A value of "disable" disables this feature completely, while a value of 0
* forces a file-system sync after completing compression of every journal
* slice.
*
* @return The file-system sync frequency, as an integer or "disable".
*/
public String getMinRawFileSyncSecs() {
return getString("minRawFileSyncSecs");
}
/**
* Returns the minimum time attribute for this index.
*
* @return The minimum time attribute, or {@code null} if not specified.
*/
public Date getMinTime() {
return getDate("minTime", null);
}
/**
* Returns the number of hot buckets that were created for this index.
*
* @return The number of hot buckets.
*/
public int getNumHotBuckets() {
return getInteger("numHotBuckets", 0);
}
/**
* Returns the number of warm buckets created for this index.
*
* @return The number of warm buckets.
*/
public int getNumWarmBuckets() {
return getInteger("numWarmBuckets", 0);
}
/**
* Returns the number of bloom filters created for this index.
*
* @return The number of bloom filters.
*/
public int getNumBloomfilters() {
return getInteger("numBloomfilters", 0);
}
/**
* Returns the frequency at which metadata is for partially synced (synced
* in-place) for this index. A value of 0 disables partial syncing, so
* metadata is only synced on the {@code ServiceMetaPeriod} interval.
* @see #getServiceMetaPeriod
* @see #setServiceMetaPeriod
*
* @return The metadata sync interval, in seconds.
*/
public int getPartialServiceMetaPeriod() {
return getInteger("partialServiceMetaPeriod");
}
/**
* Returns the future event-time quarantine for this index. Events
* that are newer than now plus this value are quarantined.
*
* @return The future event-time quarantine, in seconds.
*/
public int getQuarantineFutureSecs() {
return getInteger("quarantineFutureSecs");
}
/**
* Returns the past event-time quarantine for this index. Events
* that are older than now minus this value are quarantined.
*
* @return The past event-time quarantine, in seconds.
*/
public int getQuarantinePastSecs() {
return getInteger("quarantinePastSecs");
}
/**
* Returns the target uncompressed size of individual raw slices in the
* rawdata journal for this index.
*
* @return The target uncompressed size, in bytes.
*/
public int getRawChunkSizeBytes() {
return getInteger("rawChunkSizeBytes");
}
/**
* Returns the frequency to check for the need to create a new hot bucket
* and the need to roll or freeze any warm or cold buckets for this index.
*
* @return The check frequency, in seconds.
*/
public int getRotatePeriodInSecs() {
return getInteger("rotatePeriodInSecs");
}
/**
* Returns the frequency at which metadata is synced to disk for this index.
*
* @return The meta data sync frequency, in seconds.
*/
public int getServiceMetaPeriod() {
return getInteger("serviceMetaPeriod");
}
/**
* Returns a list of indexes that suppress "index missing" messages.
*
* @return A comma-separated list of indexes.
*/
public String getSuppressBannerList() {
return getString("suppressBannerList", null);
}
/**
* Returns the number of events that trigger the indexer to sync events.
* This value is global, not a per-index value.
*
* @return The number of events that trigger the indexer to sync events.
*/
public int getSync() {
return getInteger("sync");
}
/**
* Indicates whether the sync operation is called before the file
* descriptor is closed on metadata updates.
*
* @return {@code true} if the sync operation is called before the file
* descriptor is closed on metadata updates, {@code false} if not.
*/
public boolean getSyncMeta() {
return getBoolean("syncMeta");
}
/**
* Returns the absolute path to the thawed index for this index. This value
* may contain shell expansion terms.
*
* @return The absolute path to the thawed index, or {@code null} if not
* specified.
*/
public String getThawedPath() {
return getString("thawedPath", null);
}
/**
* Returns the expanded absolute path to the thawed index for this index.
*
* @return The expanded absolute path to the thawed index, or {@code null}
* if not specified.
*/
public String getThawedPathExpanded() {
return getString("thawedPath_expanded", null);
}
/**
* Returns the frequency at which Splunk checks for an index throttling
* condition.
*
* @return The frequency of the throttling check, in seconds.
*/
public int getThrottleCheckPeriod() {
return getInteger("throttleCheckPeriod");
}
/**
* Returns the total event count for this index.
*
* @return The total event count.
*/
public int getTotalEventCount() {
return getInteger("totalEventCount");
}
/**
* Indicates whether this index is an internal index.
*
* @return {@code true} if this index is an internal index, {@code false}
* if not.
*/
public boolean isInternal() {
return getBoolean("isInternal");
}
/**
* Performs rolling hot buckets for this index.
*/
public void rollHotBuckets() {
ResponseMessage response = service.post(path + "/roll-hot-buckets");
assert(response.getStatus() == 200);
}
/**
* Sets whether the data retrieved from this index is UTF8-encoded.
* <p>
* <b>Note:</b> Indexing performance degrades when this parameter is set to
* {@code true}.
*
* In Splunk 5.0 and later, this is a global property and cannot be set on
* a per-index basis.
*
* @param assure {@code true} to ensure UTF8 encoding, {@code false} if not.
*/
public void setAssureUTF8(boolean assure) {
setCacheValue("assureUTF8", assure);
}
/**
* Sets the number of events that make up a block for block signatures. A
* value of 100 is recommended. A value of 0 disables block signing for this
* index.
*
* @param value The event count for block signing.
*/
public void setBlockSignSize(int value) {
setCacheValue("blockSignSize", value);
}
/**
* Sets the suggested size of the .tsidx file for the bucket rebuild
* process.
*
* Valid values are: "auto", a positive integer, or a positive
* integer followed by "KB", "MB", or "GB".
*
* @param value The suggested size of the .tsidx file for the bucket rebuild
* process.
*/
public void setBucketRebuildMemoryHint(String value) {
setCacheValue("bucketRebuildMemoryHint", value);
}
/**
* Sets the destination path for the frozen archive, where Splunk
* automatically puts frozen buckets. The bucket freezing policy is as
* follows:
* <ul><li><b>New-style buckets (4.2 and later):</b> All files are removed
* except the raw data. To thaw frozen buckets, run {@code Splunk rebuild
* <bucket dir>} on the bucket, then move the buckets to the thawed
* directory.</li>
* <li><b>Old-style buckets (4.1 and earlier):</b> gzip all the .data and
* .tsidx files. To thaw frozen buckets, gunzip the zipped files and move
* the buckets to the thawed directory.</li></ul>
* If both {@code coldToFrozenDir} and {@code coldToFrozenScript} are
* specified, {@code coldToFrozenDir} takes precedence.
* @see #setColdToFrozenScript
* @see #getColdToFrozenScript
*
* @param destination The destination path for the frozen archive.
*/
public void setColdToFrozenDir(String destination) {
setCacheValue("coldToFrozenDir", destination);
}
/**
* Sets the path to the archiving script.
* <p>For more info about archiving scripts, see the
* <a href="http://docs.splunk.com/Documentation/Splunk/latest/RESTAPI/RESTindex#POST_data.2Findexes"
* target="_blank">POST data/indexes endpoint</a> in the REST API
* documentation.
* @see #setColdToFrozenDir
* @see #getColdToFrozenDir
*
* @param script The path to the archiving script.
*/
public void setColdToFrozenScript(String script) {
setCacheValue("coldToFrozenScript", script);
}
/**
* Sets whether asynchronous "online fsck" bucket repair is enabled.
* <p>
* When this feature is enabled, you don't have to wait for buckets to be
* repaired before starting Splunk, but you might notice a slight
* degradation in performance as a result.
*
* @param value {@code true} to enable online bucket repair, {@code false}
* if not.
*/
public void setEnableOnlineBucketRepair(boolean value) {
setCacheValue("enableOnlineBucketRepair", value);
}
/**
* Sets the maximum age for a bucket, after which the data in this index
* rolls to frozen. Freezing data removes it from the index. To archive
* data, see {@code coldToFrozenDir} and {@code coldToFrozenScript}.
* @see #setColdToFrozenDir
* @see #setColdToFrozenScript
*
* @param seconds The time, in seconds, after which indexed data rolls to
* frozen.
*/
public void setFrozenTimePeriodInSecs(int seconds) {
setCacheValue("frozenTimePeriodInSecs", seconds);
}
/**
* Sets the time that indicates a bucket age. When a warm or cold bucket
* is older than this, Splunk does not create or rebuild its bloomfilter.
* The valid format is <i>number</i> followed by a time unit ("s", "m", "h",
* or "d"). For example, "30d" for 30 days.
* @param time The time that indicates a bucket age.
*/
public void setMaxBloomBackfillBucketAge(String time) {
setCacheValue("maxBloomBackfillBucketAge", time);
}
/**
* Sets the number of concurrent optimize processes that can run against
* a hot bucket for this index.
*
* @param processes The number of concurrent optimize processes.
*/
public void setMaxConcurrentOptimizes(int processes) {
setCacheValue("maxConcurrentOptimizes", processes);
}
/**
* Sets the maximum data size before triggering a roll from hot to warm
* buckets for this index. You can also specify a value to let Splunk
* autotune this parameter: use "auto_high_volume" for high-volume indexes
* (such as the main index, or one that gets over 10GB of data per day);
* otherwise, use "auto".
* @see #getMaxDataSize
*
* @param size The size in MB, or an autotune string.
*/
public void setMaxDataSize(String size) {
setCacheValue("maxDataSize", size);
}
/**
* Sets the maximum number of hot buckets that can exist per index.
* <p>
* When {@code maxHotBuckets} is exceeded, Splunk rolls the least recently
* used (LRU) hot bucket to warm. Both normal hot buckets and quarantined
* hot buckets count towards this total. This setting operates independently
* of {@code MaxHotIdleSecs}, which can also cause hot buckets to roll.
* @see #setMaxHotIdleSecs
* @see #getMaxHotIdleSecs
*
* @param size The maximum number of hot buckets per index, or an 'auto' string.
*/
public void setMaxHotBuckets(String size) {
setCacheValue("maxHotBuckets", size);
}
/**
* Sets the maximum lifetime of a hot bucket for this index.
* <p>
* If a hot bucket exceeds this value, Splunk rolls it to warm.
* This setting operates independently of {@code MaxHotBuckets}, which can
* also cause hot buckets to roll.
* @see #setMaxHotBuckets
* @see #getMaxHotBuckets
*
* @param seconds The hot bucket's maximum lifetime, in seconds. A value of
* 0 means an infinite lifetime.
*/
public void setMaxHotIdleSecs(int seconds) {
setCacheValue("maxHotIdleSecs", seconds);
}
/**
* Sets the upper bound of the target maximum timespan of hot and warm
* buckets for this index.
* <p>
* <b>Note:</b> If you set this too small, you can get an explosion of
* hot and warm buckets in the file system. The system sets a lower bound
* implicitly for this parameter at 3600, but this advanced parameter should
* be set with care and understanding of the characteristics of your data.
*
* @param seconds The upper bound of the target maximum timespan, in
* seconds.
*/
public void setMaxHotSpanSecs(int seconds) {
setCacheValue("maxHotSpanSecs", seconds);
}
/**
* Sets the amount of memory allocated for buffering a single .tsidx
* file before flushing to disk.
*
* @param memory The amount of memory, in MB.
*/
public void setMaxMemMB(int memory) {
setCacheValue("maxMemMB", memory);
}
/**
* Sets the maximum number of unique lines in .data files in a bucket, which
* may help to reduce memory consumption.
* <p>
* If this value is exceeded, a hot bucket is rolled to prevent a further
* increase. If your buckets are rolling due to Strings.data hitting this
* limit, the culprit might be the "punct" field in your data. If you don't
* use that field, it might be better to just disable this (see the
* props.conf.spec in $SPLUNK_HOME/etc/system/README).
*
* @param entries The maximum number of unique lines. A value of 0 means
* infinite lines.
*/
public void setMaxMetaEntries(int entries) {
setCacheValue("maxMetaEntries", entries);
}
/**
* Sets the upper limit for how long an event can sit in a
* raw slice. This value applies only when replication is enabled for this
* index, and is ignored otherwise.<br>
* If there are any acknowledged events sharing this raw slice, the
* {@code MaxTimeUnreplicatedWithAcksparamater} applies instead.
*
* @param value The upper limit, in seconds. A value of 0 disables this
* setting.
*/
public void setMaxTimeUnreplicatedNoAcks(int value) {
setCacheValue("maxTimeUnreplicatedNoAcks", value);
}
/**
* Sets the upper limit for how long an event can sit unacknowledged in a
* raw slice. This value only applies when indexer acknowledgement is
* enabled on forwarders and replication is enabled with clustering.
* <p>
* This number should not exceed the acknowledgement timeout configured on
* any forwarder.
*
* @param value The upper limit, in seconds. A value of 0 disables this
* setting (not recommended).
*/
public void setMaxTimeUnreplicatedWithAcks(int value) {
setCacheValue("maxTimeUnreplicatedWithAcks", value);
}
/**
* Sets the maximum size for this index. If an index grows larger than this
* value, the oldest data is frozen.
*
* @param size The maximum index size, in MB.
*/
public void setMaxTotalDataSizeMB(int size) {
setCacheValue("maxTotalDataSizeMB", size);
}
/**
* Sets the maximum number of warm buckets. If this number is exceeded,
* the warm buckets with the lowest value for their latest times will be
* moved to cold.
*
* @param buckets The maximum number of warm buckets.
*/
public void setMaxWarmDBCount(int buckets) {
setCacheValue("maxWarmDBCount", buckets);
}
/**
* Sets the frequency at which Splunkd forces a file system sync while
* compressing journal slices for this index. A value of "disable" disables
* this feature completely, while a value of 0 forces a file-system sync
* after completing compression of every journal slice.
*
* @param frequency The file-system sync frequency, as an integer or
* "disable".
*/
public void setMinRawFileSyncSecs(String frequency) {
setCacheValue("minRawFileSyncSecs", frequency);
}
/**
* Sets the frequency at which metadata is for partially synced (synced
* in-place) for this index. A value of 0 disables partial syncing, so
* metadata is only synced on the {@code ServiceMetaPeriod} interval.
* @see #setServiceMetaPeriod
* @see #getServiceMetaPeriod
*
* @param frequency The metadata sync interval, in seconds.
*/
public void setPartialServiceMetaPeriod(int frequency) {
setCacheValue("partialServiceMetaPeriod", frequency);
}
/**
* Sets a quarantine for events that are timestamped in the future to help
* prevent main hot buckets from being polluted with fringe events. Events
* that are newer than "now" plus this value are quarantined.
*
* @param window The future event-time quarantine, in seconds.
*/
public void setQuarantineFutureSecs(int window) {
setCacheValue("quarantineFutureSecs", window);
}
/**
* Sets a quarantine for events that are timestamped in the past to help
* prevent main hot buckets from being polluted with fringe events. Events
* that are older than "now" plus this value are quarantined.
*
* @param window The past event-time quarantine, in seconds.
*/
public void setQuarantinePastSecs(int window) {
setCacheValue("quarantinePastSecs", window);
}
/**
* Sets the target uncompressed size of individual raw slices in the rawdata
* journal for this index.