I have elasticsearch and Kibana are up and running and I want to read logs using logstash so for that I have passed csv file as an input in logstash.conf file but its not reading logs and shutting down automatically.

This is how I am running logstash command:

```
D:\logstash-8.1.0\bin>logstash -f "D:/logstash.conf" 

```

**logstash.conf**

```
input{
 file{
   path => "D:/unicorn.csv"
   start_position => beginning
 }
}
output{
  elasticsearch{
    hosts => "localhost:9200"
    index => "indexforlogstash"
}
stdout{}
}

```

Below are the terminal output:

```
 "Using bundled JDK: ."
OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and 
will likely be removed in a future release.
Sending Logstash logs to D:/logstash-8.1.0/logs which is now configured via log4j2.properties
[2022-03-16T12:59:47,905][INFO ][logstash.runner          ] Log4j configuration path used is: 
D:\logstash-8.1.0\config\log4j2.properties
[2022-03-16T12:59:47,938][WARN ][logstash.runner          ] The use of JAVA_HOME has been d 
deprecated. Logstash 8.0 and later ignores JAVA_HOME and uses the bundled JDK. Running 
Logstash with the bundled JDK is recommended. The bundled JDK has been verified to work with 
each specific version of Logstash, and generally provides best performance and reliability. If 
you have compelling reasons for using your own JDK (organizational-specific compliance 
requirements, for example), you can configure LS_JAVA_HOME to use that version instead.
[2022-03-16T12:59:47,942][INFO ][logstash.runner          ] Starting Logstash 
{"logstash.version"=>"8.1.0", "jruby.version"=>"jruby 9.2.20.1 (2.5.8) 2021-11-30 2a2962fbd1 
OpenJDK 64-Bit Server VM 11.0.13+8 on 11.0.13+8 +indy +jit [mswin32-x86_64]"}
[2022-03-16T12:59:47,947][INFO ][logstash.runner          ] JVM bootstrap flags: [-Xms1g, - 
Xmx1g, -XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, - 
XX:+UseCMSInitiatingOccupancyOnly, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, - 
Djruby.compile.invokedynamic=true, -Djruby.jit.threshold=0, -Djruby.regexp.interruptible=true, 
-XX:+HeapDumpOnOutOfMemoryError, -Djava.security.egd=file:/dev/urandom, - 
Dlog4j2.isThreadContextMapInheritable=true, --add-opens=java.base/java.security=ALL-UNNAMED, -- 
add-opens=java.base/java.io=ALL-UNNAMED, --add-opens=java.base/java.nio.channels=ALL-UNNAMED, - 
-add-opens=java.base/sun.nio.ch=ALL-UNNAMED, --add-opens=java.management/sun.management=ALL- 
UNNAMED]
 [2022-03-16T12:59:48,058][INFO ][logstash.settings        ] Creating directory 
 {:setting=>"path.queue", :path=>"D:/logstash-8.1.0/data/queue"}
 [2022-03-16T12:59:48,104][INFO ][logstash.settings        ] Creating directory 
 {:setting=>"path.dead_letter_queue", :path=>"D:/logstash-8.1.0/data/dead_letter_queue"}
 [2022-03-16T12:59:48,285][WARN ][logstash.config.source.multilocal] Ignoring the 
 'pipelines.yml' file because modules or command line options are specified
 [2022-03-16T12:59:48,347][INFO ][logstash.agent           ] No persistent UUID file found. 
 Generating new UUID {:uuid=>"84410117-2fa7-499b-b55a-43a29192540e", :path=>"D:/logstash- 
8.1.0/data/uuid"}
 [2022-03-16T12:59:55,063][ERROR][logstash.config.sourceloader] No configuration found in the 
 configured sources.
 [2022-03-16T12:59:55,424][INFO ][logstash.agent           ] Successfully started Logstash API 
 endpoint {:port=>9600, :ssl_enabled=>false}
 [2022-03-16T13:00:00,591][INFO ][logstash.runner          ] Logstash shut down.
 [2022-03-16T13:00:00,609][FATAL][org.logstash.Logstash    ] Logstash stopped processing 
 because of an error: (SystemExit) exit
 org.jruby.exceptions.SystemExit: (SystemExit) exit
    at org.jruby.RubyKernel.exit(org/jruby/RubyKernel.java:747) ~[jruby.jar:?]
    at org.jruby.RubyKernel.exit(org/jruby/RubyKernel.java:710) ~[jruby.jar:?]
    at D_3a_.logstash_minus_8_dot_1_dot_0.lib.bootstrap.environment.<main>(D:\logstash- 
8.1.0\lib\bootstrap\environment.rb:94) ~[?:?]

```

Someone let me know what I am doing wrong.
['https://Stackoverflow.com/questions/71493412', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/7780102/']
It's actually very simple. Since you use `&&` as an operator, gcc can deduce that the condition always yields false.

If you use the bitwise and operator (`&`), gcc adds code for the if:

```
#include <stdio.h>
unsigned char c = 0xff;
int n = 1;

int main(){ 
 if ((c & 0xc0) == 0xc0 )  { 
        n=0; 
      }
  printf("%d\n", n);
}

```

yields:

```
ronald@oncilla:~/tmp$ cc -S x.c && cat x.s
    .file   "x.c"
    .text
    .globl  c
    .data
    .type   c, @object
    .size   c, 1
c:
    .byte   -1
    .globl  n
    .align 4
    .type   n, @object
    .size   n, 4
n:
    .long   1
    .section    .rodata
.LC0:
    .string "%d\n"
    .text
    .globl  main
    .type   main, @function
main:
.LFB0:
    .cfi_startproc
    endbr64
    pushq   %rbp
    .cfi_def_cfa_offset 16
    .cfi_offset 6, -16
    movq    %rsp, %rbp
    .cfi_def_cfa_register 6
    movzbl  c(%rip), %eax
    movzbl  %al, %eax
    andl    $192, %eax
    cmpl    $192, %eax
    jne .L2
    movl    $0, n(%rip)
.L2:
    movl    n(%rip), %eax
    movl    %eax, %esi
    leaq    .LC0(%rip), %rdi
    movl    $0, %eax
    call    printf@PLT
    movl    $0, %eax
    popq    %rbp
    .cfi_def_cfa 7, 8
    ret
    .cfi_endproc
.LFE0:
    .size   main, .-main
    .ident  "GCC: (Ubuntu 9.4.0-1ubuntu1~20.04) 9.4.0"
    .section    .note.GNU-stack,"",@progbits
    .section    .note.gnu.property,"a"
    .align 8
    .long    1f - 0f
    .long    4f - 1f
    .long    5
0:
    .string  "GNU"
1:
    .align 8
    .long    0xc0000002
    .long    3f - 2f
2:
    .long    0x3
3:
    .align 8
4:

```
In C `&&` casts operands to `bool` which even though its an `int`, it is changed to 1 meaning true, if nonzero.

`&` is a bitwise and, which returns the bits that are the same. If you combine this with `&&` it returns true if there are any bits left.

If you compile with `-Wall` you will get a warning when something gets optimized out at compile time.