35
35
36
36
#include "es.h"
37
37
#include "es_conf.h"
38
+ #include "es_conf_prop.h"
38
39
#include "es_bulk.h"
39
40
#include "murmur3.h"
40
41
@@ -1030,86 +1031,86 @@ static int cb_es_exit(void *data, struct flb_config *config)
1030
1031
/* Configuration properties map */
1031
1032
static struct flb_config_map config_map [] = {
1032
1033
{
1033
- FLB_CONFIG_MAP_STR , "index" , FLB_ES_DEFAULT_INDEX ,
1034
+ FLB_CONFIG_MAP_STR , FLB_ES_CONFIG_PROPERTY_INDEX , FLB_ES_DEFAULT_INDEX ,
1034
1035
0 , FLB_TRUE , offsetof(struct flb_elasticsearch_config , index ),
1035
1036
"Set an index name"
1036
1037
},
1037
1038
{
1038
- FLB_CONFIG_MAP_STR , "type" , FLB_ES_DEFAULT_TYPE ,
1039
+ FLB_CONFIG_MAP_STR , FLB_ES_CONFIG_PROPERTY_TYPE , FLB_ES_DEFAULT_TYPE ,
1039
1040
0 , FLB_TRUE , offsetof(struct flb_elasticsearch_config , type ),
1040
1041
"Set the document type property"
1041
1042
},
1042
1043
{
1043
- FLB_CONFIG_MAP_BOOL , "suppress_type_name" , "false" ,
1044
+ FLB_CONFIG_MAP_BOOL , FLB_ES_CONFIG_PROPERTY_SUPPRESS_TYPE_NAME , "false" ,
1044
1045
0 , FLB_TRUE , offsetof(struct flb_elasticsearch_config , suppress_type_name ),
1045
1046
"If true, mapping types is removed. (for v7.0.0 or later)"
1046
1047
},
1047
1048
1048
1049
/* HTTP Authentication */
1049
1050
{
1050
- FLB_CONFIG_MAP_STR , "http_user" , NULL ,
1051
+ FLB_CONFIG_MAP_STR , FLB_ES_CONFIG_PROPERTY_HTTP_USER , NULL ,
1051
1052
0 , FLB_TRUE , offsetof(struct flb_elasticsearch_config , http_user ),
1052
1053
"Optional username credential for Elastic X-Pack access"
1053
1054
},
1054
1055
{
1055
- FLB_CONFIG_MAP_STR , "http_passwd" , "" ,
1056
+ FLB_CONFIG_MAP_STR , FLB_ES_CONFIG_PROPERTY_HTTP_PASSWD , "" ,
1056
1057
0 , FLB_TRUE , offsetof(struct flb_elasticsearch_config , http_passwd ),
1057
1058
"Password for user defined in HTTP_User"
1058
1059
},
1059
1060
1060
1061
/* HTTP Compression */
1061
1062
{
1062
- FLB_CONFIG_MAP_STR , "compress" , NULL ,
1063
+ FLB_CONFIG_MAP_STR , FLB_ES_CONFIG_PROPERTY_COMPRESS , NULL ,
1063
1064
0 , FLB_FALSE , 0 ,
1064
1065
"Set payload compression mechanism. Option available is 'gzip'"
1065
1066
},
1066
1067
1067
1068
/* Cloud Authentication */
1068
1069
{
1069
- FLB_CONFIG_MAP_STR , "cloud_id" , NULL ,
1070
+ FLB_CONFIG_MAP_STR , FLB_ES_CONFIG_PROPERTY_CLOUD_ID , NULL ,
1070
1071
0 , FLB_FALSE , 0 ,
1071
1072
"Elastic cloud ID of the cluster to connect to"
1072
1073
},
1073
1074
{
1074
- FLB_CONFIG_MAP_STR , "cloud_auth" , NULL ,
1075
+ FLB_CONFIG_MAP_STR , FLB_ES_CONFIG_PROPERTY_CLOUD_AUTH , NULL ,
1075
1076
0 , FLB_FALSE , 0 ,
1076
1077
"Elastic cloud authentication credentials"
1077
1078
},
1078
1079
1079
1080
/* AWS Authentication */
1080
1081
#ifdef FLB_HAVE_AWS
1081
1082
{
1082
- FLB_CONFIG_MAP_BOOL , "aws_auth" , "false" ,
1083
+ FLB_CONFIG_MAP_BOOL , FLB_ES_CONFIG_PROPERTY_AWS_AUTH , "false" ,
1083
1084
0 , FLB_TRUE , offsetof(struct flb_elasticsearch_config , has_aws_auth ),
1084
1085
"Enable AWS Sigv4 Authentication"
1085
1086
},
1086
1087
{
1087
- FLB_CONFIG_MAP_STR , "aws_region" , NULL ,
1088
+ FLB_CONFIG_MAP_STR , FLB_ES_CONFIG_PROPERTY_AWS_REGION , NULL ,
1088
1089
0 , FLB_TRUE , offsetof(struct flb_elasticsearch_config , aws_region ),
1089
1090
"AWS Region of your Amazon OpenSearch Service cluster"
1090
1091
},
1091
1092
{
1092
- FLB_CONFIG_MAP_STR , "aws_sts_endpoint" , NULL ,
1093
+ FLB_CONFIG_MAP_STR , FLB_ES_CONFIG_PROPERTY_AWS_STS_ENDPOINT , NULL ,
1093
1094
0 , FLB_TRUE , offsetof(struct flb_elasticsearch_config , aws_sts_endpoint ),
1094
1095
"Custom endpoint for the AWS STS API, used with the AWS_Role_ARN option"
1095
1096
},
1096
1097
{
1097
- FLB_CONFIG_MAP_STR , "aws_role_arn" , NULL ,
1098
+ FLB_CONFIG_MAP_STR , FLB_ES_CONFIG_PROPERTY_AWS_ROLE_ARN , NULL ,
1098
1099
0 , FLB_FALSE , 0 ,
1099
1100
"AWS IAM Role to assume to put records to your Amazon OpenSearch cluster"
1100
1101
},
1101
1102
{
1102
- FLB_CONFIG_MAP_STR , "aws_external_id" , NULL ,
1103
+ FLB_CONFIG_MAP_STR , FLB_ES_CONFIG_PROPERTY_AWS_EXTERNAL_ID , NULL ,
1103
1104
0 , FLB_FALSE , 0 ,
1104
1105
"External ID for the AWS IAM Role specified with `aws_role_arn`"
1105
1106
},
1106
1107
{
1107
- FLB_CONFIG_MAP_STR , "aws_service_name" , "es" ,
1108
+ FLB_CONFIG_MAP_STR , FLB_ES_CONFIG_PROPERTY_AWS_SERVICE_NAME , "es" ,
1108
1109
0 , FLB_TRUE , offsetof(struct flb_elasticsearch_config , aws_service_name ),
1109
1110
"AWS Service Name"
1110
1111
},
1111
1112
{
1112
- FLB_CONFIG_MAP_STR , "aws_profile" , NULL ,
1113
+ FLB_CONFIG_MAP_STR , FLB_ES_CONFIG_PROPERTY_AWS_PROFILE , NULL ,
1113
1114
0 , FLB_TRUE , offsetof(struct flb_elasticsearch_config , aws_profile ),
1114
1115
"AWS Profile name. AWS Profiles can be configured with AWS CLI and are usually stored in "
1115
1116
"$HOME/.aws/ directory."
@@ -1118,68 +1119,68 @@ static struct flb_config_map config_map[] = {
1118
1119
1119
1120
/* Logstash compatibility */
1120
1121
{
1121
- FLB_CONFIG_MAP_BOOL , "logstash_format" , "false" ,
1122
+ FLB_CONFIG_MAP_BOOL , FLB_ES_CONFIG_PROPERTY_LOGSTASH_FORMAT , "false" ,
1122
1123
0 , FLB_TRUE , offsetof(struct flb_elasticsearch_config , logstash_format ),
1123
1124
"Enable Logstash format compatibility"
1124
1125
},
1125
1126
{
1126
- FLB_CONFIG_MAP_STR , "logstash_prefix" , FLB_ES_DEFAULT_PREFIX ,
1127
+ FLB_CONFIG_MAP_STR , FLB_ES_CONFIG_PROPERTY_LOGSTASH_PREFIX , FLB_ES_DEFAULT_PREFIX ,
1127
1128
0 , FLB_TRUE , offsetof(struct flb_elasticsearch_config , logstash_prefix ),
1128
1129
"When Logstash_Format is enabled, the Index name is composed using a prefix "
1129
1130
"and the date, e.g: If Logstash_Prefix is equals to 'mydata' your index will "
1130
1131
"become 'mydata-YYYY.MM.DD'. The last string appended belongs to the date "
1131
1132
"when the data is being generated"
1132
1133
},
1133
1134
{
1134
- FLB_CONFIG_MAP_STR , "logstash_prefix_separator" , "-" ,
1135
+ FLB_CONFIG_MAP_STR , FLB_ES_CONFIG_PROPERTY_LOGSTASH_PREFIX_SEPARATOR , "-" ,
1135
1136
0 , FLB_TRUE , offsetof(struct flb_elasticsearch_config , logstash_prefix_separator ),
1136
1137
"Set a separator between logstash_prefix and date."
1137
1138
},
1138
1139
{
1139
- FLB_CONFIG_MAP_STR , "logstash_prefix_key" , NULL ,
1140
+ FLB_CONFIG_MAP_STR , FLB_ES_CONFIG_PROPERTY_LOGSTASH_PREFIX_KEY , NULL ,
1140
1141
0 , FLB_TRUE , offsetof(struct flb_elasticsearch_config , logstash_prefix_key ),
1141
1142
"When included: the value in the record that belongs to the key will be looked "
1142
1143
"up and over-write the Logstash_Prefix for index generation. If the key/value "
1143
1144
"is not found in the record then the Logstash_Prefix option will act as a "
1144
1145
"fallback. Nested keys are supported through record accessor pattern"
1145
1146
},
1146
1147
{
1147
- FLB_CONFIG_MAP_STR , "logstash_dateformat" , FLB_ES_DEFAULT_TIME_FMT ,
1148
+ FLB_CONFIG_MAP_STR , FLB_ES_CONFIG_PROPERTY_LOGSTASH_DATEFORMAT , FLB_ES_DEFAULT_TIME_FMT ,
1148
1149
0 , FLB_TRUE , offsetof(struct flb_elasticsearch_config , logstash_dateformat ),
1149
1150
"Time format (based on strftime) to generate the second part of the Index name"
1150
1151
},
1151
1152
1152
1153
/* Custom Time and Tag keys */
1153
1154
{
1154
- FLB_CONFIG_MAP_STR , "time_key" , FLB_ES_DEFAULT_TIME_KEY ,
1155
+ FLB_CONFIG_MAP_STR , FLB_ES_CONFIG_PROPERTY_TIME_KEY , FLB_ES_DEFAULT_TIME_KEY ,
1155
1156
0 , FLB_TRUE , offsetof(struct flb_elasticsearch_config , time_key ),
1156
1157
"When Logstash_Format is enabled, each record will get a new timestamp field. "
1157
1158
"The Time_Key property defines the name of that field"
1158
1159
},
1159
1160
{
1160
- FLB_CONFIG_MAP_STR , "time_key_format" , FLB_ES_DEFAULT_TIME_KEYF ,
1161
+ FLB_CONFIG_MAP_STR , FLB_ES_CONFIG_PROPERTY_TIME_KEY_FORMAT , FLB_ES_DEFAULT_TIME_KEYF ,
1161
1162
0 , FLB_TRUE , offsetof(struct flb_elasticsearch_config , time_key_format ),
1162
1163
"When Logstash_Format is enabled, this property defines the format of the "
1163
1164
"timestamp"
1164
1165
},
1165
1166
{
1166
- FLB_CONFIG_MAP_BOOL , "time_key_nanos" , "false" ,
1167
+ FLB_CONFIG_MAP_BOOL , FLB_ES_CONFIG_PROPERTY_TIME_KEY_NANOS , "false" ,
1167
1168
0 , FLB_TRUE , offsetof(struct flb_elasticsearch_config , time_key_nanos ),
1168
1169
"When Logstash_Format is enabled, enabling this property sends nanosecond "
1169
1170
"precision timestamps"
1170
1171
},
1171
1172
{
1172
- FLB_CONFIG_MAP_BOOL , "include_tag_key" , "false" ,
1173
+ FLB_CONFIG_MAP_BOOL , FLB_ES_CONFIG_PROPERTY_INCLUDE_TAG_KEY , "false" ,
1173
1174
0 , FLB_TRUE , offsetof(struct flb_elasticsearch_config , include_tag_key ),
1174
1175
"When enabled, it append the Tag name to the record"
1175
1176
},
1176
1177
{
1177
- FLB_CONFIG_MAP_STR , "tag_key" , FLB_ES_DEFAULT_TAG_KEY ,
1178
+ FLB_CONFIG_MAP_STR , FLB_ES_CONFIG_PROPERTY_TAG_KEY , FLB_ES_DEFAULT_TAG_KEY ,
1178
1179
0 , FLB_TRUE , offsetof(struct flb_elasticsearch_config , tag_key ),
1179
1180
"When Include_Tag_Key is enabled, this property defines the key name for the tag"
1180
1181
},
1181
1182
{
1182
- FLB_CONFIG_MAP_SIZE , "buffer_size" , FLB_ES_DEFAULT_HTTP_MAX ,
1183
+ FLB_CONFIG_MAP_SIZE , FLB_ES_CONFIG_PROPERTY_BUFFER_SIZE , FLB_ES_DEFAULT_HTTP_MAX ,
1183
1184
0 , FLB_TRUE , offsetof(struct flb_elasticsearch_config , buffer_size ),
1184
1185
"Specify the buffer size used to read the response from the Elasticsearch HTTP "
1185
1186
"service. This option is useful for debugging purposes where is required to read "
@@ -1190,64 +1191,64 @@ static struct flb_config_map config_map[] = {
1190
1191
1191
1192
/* Elasticsearch specifics */
1192
1193
{
1193
- FLB_CONFIG_MAP_STR , "path" , NULL ,
1194
+ FLB_CONFIG_MAP_STR , FLB_ES_CONFIG_PROPERTY_PATH , NULL ,
1194
1195
0 , FLB_FALSE , 0 ,
1195
1196
"Elasticsearch accepts new data on HTTP query path '/_bulk'. But it is also "
1196
1197
"possible to serve Elasticsearch behind a reverse proxy on a subpath. This "
1197
1198
"option defines such path on the fluent-bit side. It simply adds a path "
1198
1199
"prefix in the indexing HTTP POST URI"
1199
1200
},
1200
1201
{
1201
- FLB_CONFIG_MAP_STR , "pipeline" , NULL ,
1202
+ FLB_CONFIG_MAP_STR , FLB_ES_CONFIG_PROPERTY_PIPELINE , NULL ,
1202
1203
0 , FLB_FALSE , 0 ,
1203
1204
"Newer versions of Elasticsearch allows to setup filters called pipelines. "
1204
1205
"This option allows to define which pipeline the database should use. For "
1205
1206
"performance reasons is strongly suggested to do parsing and filtering on "
1206
1207
"Fluent Bit side, avoid pipelines"
1207
1208
},
1208
1209
{
1209
- FLB_CONFIG_MAP_BOOL , "generate_id" , "false" ,
1210
+ FLB_CONFIG_MAP_BOOL , FLB_ES_CONFIG_PROPERTY_GENERATE_ID , "false" ,
1210
1211
0 , FLB_TRUE , offsetof(struct flb_elasticsearch_config , generate_id ),
1211
1212
"When enabled, generate _id for outgoing records. This prevents duplicate "
1212
1213
"records when retrying ES"
1213
1214
},
1214
1215
{
1215
- FLB_CONFIG_MAP_STR , "write_operation" , "create" ,
1216
+ FLB_CONFIG_MAP_STR , FLB_ES_CONFIG_PROPERTY_WRITE_OPERATION , "create" ,
1216
1217
0 , FLB_TRUE , offsetof(struct flb_elasticsearch_config , write_operation ),
1217
1218
"Operation to use to write in bulk requests"
1218
1219
},
1219
1220
{
1220
- FLB_CONFIG_MAP_STR , "id_key" , NULL ,
1221
+ FLB_CONFIG_MAP_STR , FLB_ES_CONFIG_PROPERTY_ID_KEY , NULL ,
1221
1222
0 , FLB_TRUE , offsetof(struct flb_elasticsearch_config , id_key ),
1222
1223
"If set, _id will be the value of the key from incoming record."
1223
1224
},
1224
1225
{
1225
- FLB_CONFIG_MAP_BOOL , "replace_dots" , "false" ,
1226
+ FLB_CONFIG_MAP_BOOL , FLB_ES_CONFIG_PROPERTY_REPLACE_DOTS , "false" ,
1226
1227
0 , FLB_TRUE , offsetof(struct flb_elasticsearch_config , replace_dots ),
1227
1228
"When enabled, replace field name dots with underscore, required by Elasticsearch "
1228
1229
"2.0-2.3."
1229
1230
},
1230
1231
1231
1232
{
1232
- FLB_CONFIG_MAP_BOOL , "current_time_index" , "false" ,
1233
+ FLB_CONFIG_MAP_BOOL , FLB_ES_CONFIG_PROPERTY_CURRENT_TIME_INDEX , "false" ,
1233
1234
0 , FLB_TRUE , offsetof(struct flb_elasticsearch_config , current_time_index ),
1234
1235
"Use current time for index generation instead of message record"
1235
1236
},
1236
1237
1237
1238
/* Trace */
1238
1239
{
1239
- FLB_CONFIG_MAP_BOOL , "trace_output" , "false" ,
1240
+ FLB_CONFIG_MAP_BOOL , FLB_ES_CONFIG_PROPERTY_TRACE_OUTPUT , "false" ,
1240
1241
0 , FLB_TRUE , offsetof(struct flb_elasticsearch_config , trace_output ),
1241
1242
"When enabled print the Elasticsearch API calls to stdout (for diag only)"
1242
1243
},
1243
1244
{
1244
- FLB_CONFIG_MAP_BOOL , "trace_error" , "false" ,
1245
+ FLB_CONFIG_MAP_BOOL , FLB_ES_CONFIG_PROPERTY_TRACE_ERROR , "false" ,
1245
1246
0 , FLB_TRUE , offsetof(struct flb_elasticsearch_config , trace_error ),
1246
1247
"When enabled print the Elasticsearch exception to stderr (for diag only)"
1247
1248
},
1248
1249
1249
1250
{
1250
- FLB_CONFIG_MAP_STR , "upstream" , NULL ,
1251
+ FLB_CONFIG_MAP_STR , FLB_ES_CONFIG_PROPERTY_UPSTREAM , NULL ,
1251
1252
0 , FLB_FALSE , 0 ,
1252
1253
"Path to 'upstream' configuration file (define multiple nodes)"
1253
1254
},
0 commit comments