Monthly Archives: April 2013

Setting Up Remote Syslog to MySQL With Cisco IOS and Syslog-ng in Linux

First, syslog-ng

I use Ubuntu, so I can also use their practical package manager and run

apt-get install syslog-ng

Then whip up /etc/syslog-ng/syslog-ng.conf in your favourite editor and add this to the configuration.

source s_net {

udp(ip(10.0.0.58) port(514));

tcp(ip(10.0.0.58) port(51400));

};

The 10.0.0.58 should be the IP address that you want syslog-ng to listen on, it has to be bound up to the server that runs syslog-ng.

Also add this to make syslog-ng write to a special pipe:

destination d_mysql {

pipe(“/tmp/mysql.pipe”

template(“INSERT INTO logs (host, facility, priority, level, tag, date,

time, program, msg) VALUES ( ‘$HOST’, ‘$FACILITY’, ‘$PRIORITY’, ‘$LEVEL’,’$TAG’,

‘$YEAR-$MONTH-$DAY’, ‘$HOUR:$MIN:$SEC’, ‘$PROGRAM’, ‘$MSG’ );n”) template-escape(yes));

};

And to make things that comes from s_net go to d_mysql:

log {

source(s_net);

destination(d_mysql);

};

Make a pipe that syslog-ng can write to with this command:

mkfifo /tmp/mysql.pipe

MySQL

Setup the MySQL database like this:

CREATE DATABASE syslog

USE syslog

CREATE TABLE logs (

host varchar(32) default NULL,

facility varchar(10) default NULL,

priority varchar(10) default NULL,

level varchar(10) default NULL,

tag varchar(10) default NULL,

date date default NULL,

time time default NULL,

program varchar(15) default NULL,

msg text,

seq int(10) unsigned NOT NULL auto_increment,

PRIMARY KEY (seq),

KEY host (host),

KEY seq (seq),

KEY program (program),

KEY time (time),

KEY date (date),

KEY priority (priority),

KEY facility (facility)

) TYPE=MyISAM;

# Also create the user, replace username and password

GRANT ALL PRIVILEGES ON syslog.* TO syslogng@localhost IDENTIFIED BY ‘mypassword’;

Run this command to pipe the queries to MySQL, preferably in a screen or make a script that can run it in the background.

mysql -u syslogng –password=mypassword syslog Cisco Syslog Configuration

Now all you have to do on the cisco router is one simple command to make it log to the syslog database.

Router(config)# logging 10.0.0.58

This will make the Cisco Router send all logging output to the syslog-ng process on 10.0.0.58

I have made a simple PHP page that makes the syslog output more viewable, it is something one can do with ease.

[ad_2]

Source link

Advantages of Using PHP Frameworks in Contract PHP Programming

PHP is known as server side scripting language and used in all known operating systems like Windows, UNIX, Linux etc. Nowadays PHP frameworks are a step ahead of the general PHP coding format. Majority of innovative PHP programmers are using these types of frameworks for different performance tuning issues.

These well known PHP frameworks like CakePHP, Codeigniter, Zend etc. supports maximum reputed database connections like SQL, My SQL, Oracle, ODBC thus it becomes as an easy choice for contract programmers. These latest frameworks are also much popular due to its embedded coding directly and can be carried by nearly all of the web servers.

These superlative PHP frameworks follow MVC (model view controller) coding style which is a great combination of database application (model), HTML coding (view) and input / output instructions (controller). Applying this MVC style will make your code lightweight, sharp and secure.

Core advantages of using PHP framework

1. Fast: As these frameworks are following MVC, you need not take hazards of thousand lines of complex coding. Thus it is easily assumable that due to optimized coding it will run faster.

2. Lightweight: These frameworks has inbuilt core library with them and thus the coding is much lightweight in nature than normal one. Here you need not follow vast complex coding structure what we see in the normal ones.

3. Recycle of coding: By using these frameworks in web development, several basic features are almost same, and thus you can recycle the same code (modify necessarily) of any module in different projects.

4. Reliable: frameworks already run on millions of worldwide servers, which fundamentally proves that they are powerful enough for the most demanding situations and also prove that much secure enough to use.

5. Capable: These frameworks have several creative functions that are prepared for you to have an edge in your coding. There are functions for handling date formats, database connections, handling emails, editing strings etc.

6. Easy debugging: PHP frameworks have their own specific debugging methodologies that allow you to easily spot out the errors in your development.

7. Extendable: You can effortlessly extend your PHP coding through these frameworks to get the specific functions that you like to integrate in your website development.

8. Community help: You never ever feel alone while coding with these framework. When ever you feel any pressure, you can ask for help in communities. There are good numbers of developers that will surely help in your development.

[ad_2]

Source link

Dreamweaver and Its Capabilities

The most popular web authoring tool for putting together websites is Dreamweaver. A typical site will have various different types of media on it. It is necessary to understand what Dreamweaver can and can’t do in terms of editing your website. It’s primary purpose is for editing and generating code and this should be understood.

Dreamweaver has many tools for managing images on your webpage. You can position and resize graphics on your webpage. more sophisticated editing of an graphic is however not possible and will require the use of a graphic manipulation application such as Photoshop or GIMP. It is possible to give images borders or make them hyperlinks using Dreamweaver. Animated GIFs can also be manipulated in this way but Dreamweaver cannot edit the animation content. Rollover graphics on the other hand are a different matter. Dreamweaver provides a handy wizard for making images change when you move the mouse over them. Dreamweaver does this by adding Javascript to your code. There will be a Dreamweaver tutorial online for all these different methods if you wish to incorporate them into your site.

Dreamweaver also allows you to position and resize Flash animations. Exercise caution when stretching a Flash animation however as it can effect the content. For creating and editing animations Dreamweaver is not a candidate. For that purpose you would need a copy of Adobe Flash. Dreamweaver also cannot be used to change video or audio clips but it does provide wizards to allow you to easily embed relevant players into your page. Audacity is a free to download online software you can use for audio editing. It is worth investing in a copy of Final Cut if you are seeking to do some in depth video editing. Once again, a Dreamweaver tutorial can be located online for any of these methods.

Dreamweaver can also be used to generate some simple PHP code. For example, you can add buttons and text fields to your page to create forms. Then in turn you can use one of it’s wizards to link up to your database. Dreamweaver has only been developed to generate basic PHP code. If you’re looking to do something more complex like creating a subscription plan or ecommerce for your website you will need more than just a wizard and good knowledge on the subject. If you’re planning to set up anything with money involved additional care needs to be taken. You don’t want to find yourself breaking the law due to developing your site in the wrong way.

The main benefit of Dreamweaver is that it lets you to preview your site while you code and also lets you directly adjust the design without adjusting the code. With the tools and features available through Dreamweaver you can format text, create shapes and adjust graphics without editing the code. Dreamweaver only gets you so far though. For in depth editing of animations, images, video and audio you will need other applications. If you’re ever stuck trying to do something a bit more complicated and the tool to use isn’t obvious then it is highly recommended to look up a Dreamweaver tutorial.

[ad_2]

Source link