2525#include <fluent-bit/flb_config_map.h>
2626#include <fluent-bit/flb_gzip.h>
2727#include <fluent-bit/flb_base64.h>
28- #include <fluent-bit/flb_sqldb.h>
2928#include <fluent-bit/flb_input_blob.h>
3029#include <fluent-bit/flb_log_event_decoder.h>
3130#include <fluent-bit/flb_plugin.h>
3534#include <msgpack.h>
3635
3736#include "azure_blob.h"
38- #include "azure_blob_db.h"
3937#include "azure_blob_uri.h"
4038#include "azure_blob_conf.h"
4139#include "azure_blob_appendblob.h"
4240#include "azure_blob_blockblob.h"
4341#include "azure_blob_http.h"
4442#include "azure_blob_store.h"
4543
44+ #ifdef FLB_HAVE_SQLDB
45+ #include "azure_blob_db.h"
46+ #endif
47+
4648#define CREATE_BLOB 1337
4749
4850/* thread_local_storage for workers */
@@ -248,6 +250,7 @@ static int create_blob(struct flb_azure_blob *ctx, char *name)
248250 return FLB_OK ;
249251}
250252
253+ #ifdef FLB_HAVE_SQLDB
251254static int delete_blob (struct flb_azure_blob * ctx , char * name )
252255{
253256 int ret ;
@@ -322,6 +325,7 @@ static int delete_blob(struct flb_azure_blob *ctx, char *name)
322325 flb_upstream_conn_release (u_conn );
323326 return FLB_OK ;
324327}
328+ #endif
325329
326330static int http_send_blob (struct flb_config * config , struct flb_azure_blob * ctx ,
327331 flb_sds_t ref_name ,
@@ -488,16 +492,23 @@ static int send_blob(struct flb_config *config,
488492 if (!block_id ) {
489493 flb_plg_error (ctx -> ins , "could not generate block id" );
490494 flb_free (generated_random_string );
491- cfl_sds_destroy (ref_name );
495+ flb_sds_destroy (ref_name );
492496 return FLB_RETRY ;
493497 }
494498 uri = azb_block_blob_uri (ctx , tag , block_id , ms , generated_random_string );
495499 ref_name = flb_sds_printf (& ref_name , "file=%s.%" PRIu64 , name , ms );
496500 }
497501 else if (event_type == FLB_EVENT_TYPE_BLOBS ) {
502+ #ifdef FLB_HAVE_SQLDB
498503 block_id = azb_block_blob_id_blob (ctx , name , part_id );
499504 uri = azb_block_blob_uri (ctx , name , block_id , 0 , generated_random_string );
500505 ref_name = flb_sds_printf (& ref_name , "file=%s:%" PRIu64 , name , part_id );
506+ #else
507+ flb_plg_error (ctx -> ins , "FLB_EVENT_TYPE_BLOBS requires FLB_HAVE_SQLDB enabled at build time" );
508+ flb_free (generated_random_string );
509+ flb_sds_destroy (ref_name );
510+ return FLB_ERROR ;
511+ #endif
501512 }
502513 }
503514
@@ -772,6 +783,7 @@ static int cb_azure_blob_init(struct flb_output_instance *ins,
772783 return 0 ;
773784}
774785
786+ #ifdef FLB_HAVE_SQLDB
775787static int blob_chunk_register_parts (struct flb_azure_blob * ctx , uint64_t file_id , size_t total_size )
776788{
777789 int ret ;
@@ -1171,6 +1183,7 @@ static int azb_timer_create(struct flb_azure_blob *ctx)
11711183
11721184 return 0 ;
11731185}
1186+ #endif
11741187
11751188/**
11761189 * Azure Blob Storage ingestion callback function
@@ -1660,6 +1673,7 @@ static void cb_azure_blob_flush(struct flb_event_chunk *event_chunk,
16601673 }
16611674 }
16621675 else if (event_chunk -> type == FLB_EVENT_TYPE_BLOBS ) {
1676+ #ifdef FLB_HAVE_SQLDB
16631677 /*
16641678 * For Blob types, we use the flush callback to enqueue the file, then cb_azb_blob_file_upload()
16651679 * takes care of the rest like reading the file and uploading it to Azure.
@@ -1668,6 +1682,9 @@ static void cb_azure_blob_flush(struct flb_event_chunk *event_chunk,
16681682 if (ret == -1 ) {
16691683 FLB_OUTPUT_RETURN (FLB_RETRY );
16701684 }
1685+ #else
1686+ ret = FLB_ERROR ;
1687+ #endif
16711688 }
16721689
16731690 if (json ){
@@ -1728,11 +1745,13 @@ static int cb_worker_init(void *data, struct flb_config *config)
17281745 FLB_TLS_SET (worker_info , info );
17291746 }
17301747
1748+ #ifdef FLB_HAVE_SQLDB
17311749 ret = azb_timer_create (ctx );
17321750 if (ret == -1 ) {
17331751 flb_plg_error (ctx -> ins , "failed to create upload timer" );
17341752 return -1 ;
17351753 }
1754+ #endif
17361755
17371756 return 0 ;
17381757}
0 commit comments