fluent-plugin-sql icon indicating copy to clipboard operation
fluent-plugin-sql copied to clipboard

Oracle

Open ploef opened this issue 10 years ago • 4 comments

Hi,

I just started using Fluentd and am looking for a way of saving events to an Oracle database. At the moment I'm trying to use the enhanced_oracle adapter but it just doesn't seem to work. Fluentd starts and exists without error. Could you point me in the right direction on how to set this up? Do I also need to install an Oracle client?

Best regards,

Peter

ploef avatar Sep 29 '15 18:09 ploef

Sorry for the delay.

sql plugin maintainers don't have an oracle adapter experience. So if you want to use Oracle with this plugin, you should debug it on your environment. Adaptor has a bug or adaptor dependent library has a bug or similar.

repeatedly avatar Nov 18 '15 20:11 repeatedly

I just get it working. I face the same problem as @ploef when I install only activerecord-oracle_enhanced-adapter. The problem is it require ruby-oci8 and oracle-instant-client. For oracle-instant-client installation see here.

For testing I have setup FluentBit to send data to FluentD.

  • FluentBit config file
[SERVICE]
    # Flush
    # =====
    # Set an interval of seconds before to flush records to a destination
    Flush        5

    # Daemon
    # ======
    # Instruct Fluent Bit to run in foreground or background mode.
    Daemon       Off

    # Log_Level
    # =========
    # Set the verbosity level of the service, values can be:
    #
    # - error
    # - warning
    # - info
    # - debug
    # - trace : only work when build with enable trace
    #
    # By default 'info' is set, that means it includes 'error' and 'warning'.
    Log_Level    debug

    # HTTP Monitoring Server
    # ======================
    #
    # HTTP_Monitor: enable/disable the HTTP Server to monitor
    #               Fluent Bit internals.
    # HTTP_Port   : specify the TCP port of the HTTP Server
    HTTP_Monitor Off
    HTTP_Port    2020

[INPUT]
    Name       cpu
    Tag        cpu_usage

[INPUT]
    Name       mem
    Tag        memory_usage

[OUTPUT]
    Name          forward
    Match         *
    Host          127.0.0.1
    Port          24224
    Retry_Limit   3
#    Retry_Limit   False
  • FluentD config file
#
# Fluentd configuration file
#

# Config input 
<source>
  @type forward
  port 24224
</source>

# Config output
<match cpu_*>
  @type stdout
</match>

<match foo_*>
  @type stdout
</match>

<match memory_*>
  @type sql
  host {DATABASE_HOSTNAME}
  port 1521
  database {DATABASE_NAME}
  adapter oracle_enhanced
  username {DATABASE_USERNAME}
  password {DATABASE_PASSWORD}

  <table>
    table fluentd_log
    column_mapping 'timestamp:created_at,Mem.total:mem_total,Mem.used:mem_used'
    # This is the default table because it has no "pattern" argument in <table>
    # The logic is such that if all non-default <table> blocks
    # do not match, the default one is chosen.
    # The default table is required.
  </table>
</match>
  • Oracle Table
CREATE TABLE FLUENTD_LOG
(
  ID          NUMBER(8),
  CREATED_AT  VARCHAR2(50 BYTE),
  MEM_TOTAL   VARCHAR2(50 BYTE),
  MEM_USED    VARCHAR2(50 BYTE)
)

@repeatedly I think you can close this issue.

NOTE: td-agent is not working with because it's embedded ruby 2.1 and activerecord-oracle_enhanced-adapter require ruby 2.2.2.

oemdaro avatar Aug 07 '17 02:08 oemdaro

@oemdaro Could you please help me with the configuration for CLOB, NCLOB type of datatype, with normal configuration null value is inserted

harsh288 avatar Aug 03 '21 17:08 harsh288

This still does not work with CLOB data type.

PODU avatar Nov 21 '21 03:11 PODU