/src/fluent-bit/plugins/in_elasticsearch/in_elasticsearch.h
Line | Count | Source |
1 | | /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
2 | | |
3 | | /* Fluent Bit |
4 | | * ========== |
5 | | * Copyright (C) 2015-2026 The Fluent Bit Authors |
6 | | * |
7 | | * Licensed under the Apache License, Version 2.0 (the "License"); |
8 | | * you may not use this file except in compliance with the License. |
9 | | * You may obtain a copy of the License at |
10 | | * |
11 | | * http://www.apache.org/licenses/LICENSE-2.0 |
12 | | * |
13 | | * Unless required by applicable law or agreed to in writing, software |
14 | | * distributed under the License is distributed on an "AS IS" BASIS, |
15 | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
16 | | * See the License for the specific language governing permissions and |
17 | | * limitations under the License. |
18 | | */ |
19 | | |
20 | | #ifndef FLB_IN_ELASTICSEARCH_H |
21 | | #define FLB_IN_ELASTICSEARCH_H |
22 | | |
23 | | #include <fluent-bit/flb_config.h> |
24 | | #include <fluent-bit/flb_input.h> |
25 | | #include <fluent-bit/flb_utils.h> |
26 | | #include <fluent-bit/flb_log_event_encoder.h> |
27 | | #include <fluent-bit/flb_record_accessor.h> |
28 | | |
29 | | #include <monkey/monkey.h> |
30 | | #include <fluent-bit/http_server/flb_http_server.h> |
31 | | |
32 | | #define HTTP_BUFFER_MAX_SIZE "4M" |
33 | | #define HTTP_BUFFER_CHUNK_SIZE "512K" |
34 | | |
35 | | struct flb_in_elasticsearch { |
36 | | flb_sds_t listen; |
37 | | flb_sds_t tcp_port; |
38 | | flb_sds_t tag_key; |
39 | | flb_sds_t meta_key; |
40 | | flb_sds_t hostname; |
41 | | flb_sds_t es_version; |
42 | | char cluster_name[16]; |
43 | | char node_name[12]; |
44 | | |
45 | | struct flb_log_event_encoder *log_encoder; |
46 | | struct flb_record_accessor *ra_tag_key; |
47 | | |
48 | | struct flb_input_instance *ins; |
49 | | |
50 | | struct flb_http_server http_server; |
51 | | }; |
52 | | |
53 | | static inline int in_elasticsearch_uses_worker_ingress_queue( |
54 | | struct flb_in_elasticsearch *ctx) |
55 | 0 | { |
56 | 0 | return ctx->http_server.workers > 1; |
57 | 0 | } Unexecuted instantiation: in_elasticsearch.c:in_elasticsearch_uses_worker_ingress_queue Unexecuted instantiation: in_elasticsearch_config.c:in_elasticsearch_uses_worker_ingress_queue Unexecuted instantiation: in_elasticsearch_bulk_prot.c:in_elasticsearch_uses_worker_ingress_queue |
58 | | |
59 | | static inline int in_elasticsearch_ingest_logs(struct flb_in_elasticsearch *ctx, |
60 | | const char *tag, |
61 | | size_t tag_len, |
62 | | const void *buf, |
63 | | size_t buf_size) |
64 | 0 | { |
65 | 0 | if (in_elasticsearch_uses_worker_ingress_queue(ctx)) { |
66 | 0 | return flb_input_ingress_queue_log(ctx->ins, tag, tag_len, buf, buf_size); |
67 | 0 | } |
68 | | |
69 | 0 | return flb_input_log_append(ctx->ins, tag, tag_len, buf, buf_size); |
70 | 0 | } Unexecuted instantiation: in_elasticsearch.c:in_elasticsearch_ingest_logs Unexecuted instantiation: in_elasticsearch_config.c:in_elasticsearch_ingest_logs Unexecuted instantiation: in_elasticsearch_bulk_prot.c:in_elasticsearch_ingest_logs |
71 | | |
72 | | |
73 | | #endif |