= dummy_service





== WriteToMongo/fluent/fluent.conf


[source,javascript]
----
<match debug.*>
  @type stdout
</match>

<source>  // <1> 
  @type tail 

  path /var/log/*.log    
  path_key tailed_path   
  pos_file /tmp/fluentd--1605454018.pos  
  pos_file_compaction_interval 30s
  refresh_interval 30s
  skip_refresh_on_startup

  tag stats.node  

  enable_stat_watcher false 
  enable_watch_timer true   
  read_from_head true
  follow_inodes true  # Without this parameter, file rotation causes log duplication

  <parse>
    @type none    

    keep_time_key true
  </parse>
</source>

<source> // <1>
  @type tail             // <2>

  path /var/log-in/*/*   // <3>
  path_key tailed_path
  pos_file /tmp/fluentd--1605454014.pos // <4>
  pos_file_compaction_interval 10s 
  refresh_interval 30s
  skip_refresh_on_startup

  tag log.node                     // <5>

  enable_stat_watcher false         // <6>
  enable_watch_timer true           // <7>
  read_from_head true
  follow_inodes true  # Without this parameter, file rotation causes log duplication
  <parse>
    @type none                // <8>

    keep_time_key true
  </parse>
</source>

<match log.*>    // <9>
  @type copy
  copy_mode deep   // <10>
  <store ignore_error>   // <11>                            
          @type mongo                  
                                       
	  connection_string mongodb://mongo.poc-datacollector_datacollector-net:27017/fluentdb  // <12>

          #database fluentdb            
          collection test              
          #host mongo.poc-datacollector_datacollector-net                       
          #port 27017                                                           
                                                                               
          num_retries 60                                                       
          capped                  // <13>                                             
          capped_size 100m        // <14>                                             
  <inject>
    # key name of timestamp
         time_key time
    </inject>
                                                                               
          <buffer>                                                             
            retry_wait 50s
              flush_mode immediate    // <15>
            #flush_interval 10s                                                 
          </buffer>                                                            
  </store>                                                        

  <store ignore_error>
        @type stdout
  </store>

  <store ignore_error>
	  @type file
	  path /tmp/mylog
	  <buffer>
	    timekey 1d
	    timekey_use_utc true
	    timekey_wait 10s
	  </buffer>
  </store>

</match>
----
<1> *<source>* directives determine the input sources. The source submits events to the Fluentd routing engine. An event consists of three entities: *tag*, *time* and *record*.
<2> *localhost* link:ROOT:dummy_service/filename.ext#tailmongo[see here]
<3> *localhost* inside of a container will resolve to the network stack of this container
<4> *localhost* inside of a container will resolve to the network stack of this container
<5> *localhost* inside of a container will resolve to the network stack of this container
<6> *localhost* inside of a container will resolve to the network stack of this container
<7> *localhost* inside of a container will resolve to the network stack of this container
<8> *localhost* inside of a container will resolve to the network stack of this container
<9> *<match>* directives determine the output destinations. The match directive looks for events with matching tags and processes them. The most common use of the match directive is to *output events to other systems*.
<10> *localhost* inside of a container will resolve to the network stack of this container
<11> *localhost* inside of a container will resolve to the network stack of this container
<12> *localhost* inside of a container will resolve to the network stack of this container
<13> *localhost* inside of a container will resolve to the network stack of this container
<14> *localhost* inside of a container will resolve to the network stack of this container
<15> *localhost* inside of a container will resolve to the network stack of this container

[#tailmongo]
.type tail
image::ROOT:fluent-mongo.png[float=right]










