Input from file output to file


(Victor) #1

Hi, I want to take a file log and process the data to other output file.

I thinck than it's a easy proccedure, but my code don´t work :frowning:

it's my first time with logstash. Sorry if the ask is very obvius.

My file log:
MODSEN:001#I:216F6F057C105410#TS:Tue, 11/11/18, 16:18:0#BAT:11#TCA:59.99#HUMA:69#PA:1020#ANE:6.7#PLUV:1.25#DIR:100#US:9.99#GPS_LAT:-34.638112#GPS_LNG:-68.397158
MODSEN:002#I:316F6F057C105410#TS:Tue, 15/12/18, 16:20:1#BAT:51#TCA:39.99#HUMA:79#PA:1020#ANE:6.7#PLUV:5.23#DIR:100#US:9.99#GPS_LAT:-14.638112#GPS_LNG:-98.397158
MODSEN:003#I:416F6F057C105510#TS:Tue, 13/01/18, 16:22:0#BAT:61#TCA:29.99#HUMA:89#PA:1020#ANE:6.7#PLUV:1.32#DIR:100#US:9.99#GPS_LAT:-24.638112#GPS_LNG:-48.397158

my conf file:
input {
file {
path => "C:\Users\001\Desktop\logs\input.log"
start_position => "beginning"
sincedb_path => "NUL"
}
}

filter {
kv {
field_split => "#"
value_split => ":"
}
}
output {
file {
path => "C:\Users\001\Desktop\logs\output.txt"
}
}

somebody can help me?

Thank you very much


(Lewis Barclay) #2

So you want to output to a text file? What is the error you are getting in the logstash log? Does the logstash process have permission to write to that location?


(Victor) #3

Yes, I want to output to text file.

My conf file is correct?

Where can I look the persmission?


(Faulander) #4

Viti, i presume you're running logstash on windows?
Can you try to output to console to see if it process the logs correctly?

Which user you're running logstash with?
check the permissions of the destination file if the user you're running logstash with has write permissions.


#5

Hello @Viti,

After checking your input code ,oberved that you need to change path:
path => "C:\Users\001\Desktop\logs\input.log"

to

path => "C:/Users/001/Desktop/logs/input.log"

Make sure tou apply the change at the output also.

Regards,
Balu


(Victor) #6

Yes, I'm in windows.

I'm doing this steps:
1 run cmd
2 cd logstash/bin
3 logstash.bat -f prueba.conf

Mi user has permissions of admin

Do I need to do anything command more for my file prueba.conf ?

I want to get the data of file input.log and writes in file output.txt

How can I do this.


(Victor) #7

This is correct, already it works.

Thank you


#8

Great, cheers!!,
mark it as a solution.

Regards,
Balu