2 deleted 58 characters in body
source | link

So, let me start with the overall outcome that i want to achieve.

There is just one log, which will have info on certain devices, that i am upgrading.

I use "tailf log" to monitor the log.

Now, say, I am upgrading 10 devices, the log will go on populating lines pertaining to ips of each 10 devices.

I am not concerned about all lines of the logs, but very few lines, like, image being copied to device, image deleted, image uploaded, device reload issued and so on..

what i am looking for is.. a script which will parse the ongoing logs, and grep for the txts that i am concerned about, like "image deleted", "device reload issued" and go on populating these grepped outputs to files named image_deletion_messages, device_reload_messages and so on..

and again, parse these files (image_deletion_messages, device_reload_messages) to determine ips from the logged messages and then save those ips to files named image_deleted_devices, reload_devices...........

And in turn, i'll monitor these files (image_deleted_devices, reload_devices) using tailf, instead of monitoring the entire log.

tailf log |grep "image deleted" >> image_deletion_messages

tailf image_deletion_messages |grep (a list of ips) >> image_deleted_devices

And the same way for other messages............

Above set of commands as part of a script..

and finally, i'll just monitor the below files alone..

tailf image_deleted_devices

and so on......

I tried the above way and it doesn't seem to work. Maybe i am doing it wrong. Please advise.

So, let me start with the overall outcome that i want to achieve.

There is just one log, which will have info on certain devices, that i am upgrading.

I use "tailf log" to monitor the log.

Now, say, I am upgrading 10 devices, the log will go on populating lines pertaining to ips of each 10 devices.

I am not concerned about all lines of the logs, but very few lines, like, image being copied to device, image deleted, image uploaded, device reload issued and so on..

what i am looking for is.. a script which will parse the ongoing logs, and grep for the txts that i am concerned about, like "image deleted", "device reload issued" and go on populating these grepped outputs to files named image_deletion_messages, device_reload_messages and so on..

and again, parse these files (image_deletion_messages, device_reload_messages) to determine ips from the logged messages and then save those ips to files named image_deleted_devices, reload_devices...........

And in turn, i'll monitor these files (image_deleted_devices, reload_devices) using tailf, instead of monitoring the entire log.

tailf log |grep "image deleted" >> image_deletion_messages

tailf image_deletion_messages |grep (a list of ips) >> image_deleted_devices

And the same way for other messages............

Above set of commands as part of a script..

and finally, i'll just monitor the below files alone..

tailf image_deleted_devices

and so on......

I tried the above way and it doesn't seem to work. Maybe i am doing it wrong. Please advise.

There is just one log, which will have info on certain devices, that i am upgrading.

I use "tailf log" to monitor the log.

Now, say, I am upgrading 10 devices, the log will go on populating lines pertaining to ips of each 10 devices.

I am not concerned about all lines of the logs, but very few lines, like, image being copied to device, image deleted, image uploaded, device reload issued and so on..

what i am looking for is.. a script which will parse the ongoing logs, and grep for the txts that i am concerned about, like "image deleted", "device reload issued" and go on populating these grepped outputs to files named image_deletion_messages, device_reload_messages and so on..

and again, parse these files (image_deletion_messages, device_reload_messages) to determine ips from the logged messages and then save those ips to files named image_deleted_devices, reload_devices...........

And in turn, i'll monitor these files (image_deleted_devices, reload_devices) using tailf, instead of monitoring the entire log.

tailf log |grep "image deleted" >> image_deletion_messages

tailf image_deletion_messages |grep (a list of ips) >> image_deleted_devices

And the same way for other messages............

Above set of commands as part of a script..

and finally, i'll just monitor the below files alone..

tailf image_deleted_devices

I tried the above way and it doesn't seem to work.

1
source | link

Need to grep for specific lines from ongoing log and save it in some file

So, let me start with the overall outcome that i want to achieve.

There is just one log, which will have info on certain devices, that i am upgrading.

I use "tailf log" to monitor the log.

Now, say, I am upgrading 10 devices, the log will go on populating lines pertaining to ips of each 10 devices.

I am not concerned about all lines of the logs, but very few lines, like, image being copied to device, image deleted, image uploaded, device reload issued and so on..

what i am looking for is.. a script which will parse the ongoing logs, and grep for the txts that i am concerned about, like "image deleted", "device reload issued" and go on populating these grepped outputs to files named image_deletion_messages, device_reload_messages and so on..

and again, parse these files (image_deletion_messages, device_reload_messages) to determine ips from the logged messages and then save those ips to files named image_deleted_devices, reload_devices...........

And in turn, i'll monitor these files (image_deleted_devices, reload_devices) using tailf, instead of monitoring the entire log.

tailf log |grep "image deleted" >> image_deletion_messages

tailf image_deletion_messages |grep (a list of ips) >> image_deleted_devices

And the same way for other messages............

Above set of commands as part of a script..

and finally, i'll just monitor the below files alone..

tailf image_deleted_devices

and so on......

I tried the above way and it doesn't seem to work. Maybe i am doing it wrong. Please advise.