import logs from specific location

This support forum board is for support questions relating to Nagios Log Server, our solution for managing and monitoring critical log data.
sangeetha
Posts: 21
Joined: Mon Sep 28, 2015 3:09 am

import logs from specific location

Post by sangeetha »

hi,

i want to import logs from specific path on my server. i have 4-5 logs files in this path. i want to load them and run some query. could you please help me with the steps to do so.
thanks.
jolson
Attack Rabbit
Posts: 2560
Joined: Thu Feb 12, 2015 12:40 pm

Re: import logs from specific location

Post by jolson »

To import your logs from flag files, you can make use of the 'file' input:

You could use either of the following inputs, for example:

Code: Select all

file {
    path => /var/log/messages
}
-or-

Code: Select all

file {
    path => /var/log/httpd/*
}
You can define an input on the 'Administration -> Global Configuration' page of the Web GUI.
Twits Blog
Show me a man who lives alone and has a perpetually clean kitchen, and 8 times out of 9 I'll show you a man with detestable spiritual qualities.
sangeetha
Posts: 21
Joined: Mon Sep 28, 2015 3:09 am

Re: import logs from specific location

Post by sangeetha »

hi,

i configured as you suggested. but still i am not able to see my logs loading on the dashboard. is there some document or video available to do this.
jolson
Attack Rabbit
Posts: 2560
Joined: Thu Feb 12, 2015 12:40 pm

Re: import logs from specific location

Post by jolson »

After you configured it, did you press the 'Apply Configuration' button?
Twits Blog
Show me a man who lives alone and has a perpetually clean kitchen, and 8 times out of 9 I'll show you a man with detestable spiritual qualities.
sangeetha
Posts: 21
Joined: Mon Sep 28, 2015 3:09 am

Re: import logs from specific location

Post by sangeetha »

hi,
yes i did. but still no results.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: import logs from specific location

Post by tmcdonald »

Did you use exactly what jolson posted or did you modify it to suit your environment?

What are you doing to search for those logs?

What sort of messages in the logs are you hoping to see?
Former Nagios employee
sangeetha
Posts: 21
Joined: Mon Sep 28, 2015 3:09 am

Re: import logs from specific location

Post by sangeetha »

i followed these below steps.

click administration -> Global configuration -> add input -> added these below lines

file {
path => '/data/logs/'
}

here /data/logs/ is the path of my logs files available.

then click save -> verify -> Apply configuration

after this, i went into dashboard and try to query for "ERROR"

but i do not get any result
jolson
Attack Rabbit
Posts: 2560
Joined: Thu Feb 12, 2015 12:40 pm

Re: import logs from specific location

Post by jolson »

Try this input:

Code: Select all

file {
path => '/data/logs/*'
}
Please "Apply Configuration" after you make the above definition. Do you see any files being generated? If not, try the following at the command line.

Switch to Nagios:

Code: Select all

su - nagios
Change to the data/logs directory:

Code: Select all

cd /data/logs
Read one of the files that exists there:

Code: Select all

tail -n100 fileexample
Add a few lines to a new file:

Code: Select all

echo "ERROR" >> newfile.log
Let me know how the above goes. When you add new lines to a file, logstash should pick up those changes almost immediately and display them to you in the Web GUI. We're also ensuring that the 'nagios' user has appropriate read and write access to the directory in question.

Jesse
Twits Blog
Show me a man who lives alone and has a perpetually clean kitchen, and 8 times out of 9 I'll show you a man with detestable spiritual qualities.
sangeetha
Posts: 21
Joined: Mon Sep 28, 2015 3:09 am

Re: import logs from specific location

Post by sangeetha »

hi,

Thank you.
this worked. but it is not picking up files which are already available there. any other settings to be done.
jolson
Attack Rabbit
Posts: 2560
Joined: Thu Feb 12, 2015 12:40 pm

Re: import logs from specific location

Post by jolson »

This means that Nagios Log Server has already parsed through the logs that are already there. What you can do is copy those files to force a re-read:

Code: Select all

cd /data/logs

Code: Select all

cp example-log-1 example-log-1-parse
The new log will be parsed appropriately. Any new lines in your existing logs will also be parsed appropriately, so you should be good to go!
Twits Blog
Show me a man who lives alone and has a perpetually clean kitchen, and 8 times out of 9 I'll show you a man with detestable spiritual qualities.
Locked