Thursday, April 21, 2016

how to use logparser

1. Download.
2. Querying IIS:

a) checking what fields can be queried:

"C:\Program Files (x86)\Log Parser 2.2\logparser.exe" -h -i:w3c file.LOG -nskiplines:3

definitions of fields (IIS7)

b) checking number client (source) addresses:

"C:\inetpub\logs\LogFiles\W3SVC1>"C:\Program Files (x86)\Log Parser 2.2\logparser.exe" "SELECT c-ip,count(c-ip) from u_ex160421.log group by c-ip"  -i:w3c -rtp:-1

c)checking number client (source) addresses in april 2016 

"C:\inetpub\logs\LogFiles\W3SVC1>"C:\Program Files (x86)\Log Parser 2.2\logparser.exe" "SELECT c-ip,count(c-ip) from u_ex1604*.log group by c-ip"  -:w3c -rtp:-1

d)checking number client (source) addresses in april 2016 with date

C:\inetpub\logs\LogFiles\W3SVC3>"C:\Program Files (x86)\Log Parser 2.2\logparser.exe" "SELECT date,count(c-ip) from u_ex1604*.log group by date"  -i:w3c -rtp:-1


3. Resources:
 a) examples
 b) extension of logparser

4. Querying exchange logs:

a) checking what fields can be queried:

D:\Microsoft\Exchange Server\V14\TransportRoles\Logs\MessageTracking>"C:\Program Files (x86)\Log Parser 2.2\logparser.exe" -h -i:CSV file.LOG -nskiplines:4

a) checking by connector-id

"C:\Program Files (x86)\Log Parser 2.2\logparser.exe" "SELECT connector-id,Count(*) as Hits from MSGTRK20160102-5.LOG  GROUP BY connector-id ORDER BY Hits DESC" -i:CSV -nSkipLines:4 -rtp:-1


Wednesday, April 20, 2016

Using Git




1. Global config:

git config --global help.autocorrect 1
git config --global core.editor notepad
git config --global core.autocflf = 1  #valid on Windows OS
git config core.autocrlf true  # use to keep endline formatting
git config --global user.name "Billy Everyteen"
git config --global user.email "Someone@gmail.com"
git config --global --list #verify config

#Windows:
git config --global core.autocrlf true
#Linux
git config --global core.autocrlf input


2. Basics

git init #Creating a new local repository

echo "Hello World" > run.cmd #add content to file
git status 

git add run.cmd or
git add -u # adds if there is new content (will not add empty new files)
git add -A #adds all files, including empty or new
git status 

git commit -m "First Commit"


git log # history of commits

git diff HEAD~1..HEAD 
git diff HEAD~1.. #veviewing differences between latest commit and previous (number controls which version to compare)

git checkout file.txt #restores previous version of file.txt
gir reset --hard # bring back version to HEAD

git reset --soft HEAD~1 #brings back previous version of code
git reset --soft HEAD~1 #deletes last commit
use .gitignore to ignore files

git clone https://github.com/jquery/jquery.git #clones project
cd jquery
git log
git log --oneline # singe line per commit
git log --oneline --graph # singe line per commit + merges
git shortlog # alphabetical log
git shortlog -sne # number of commmits with email

git show HEAD #shows last changes
git show HEAD~2 #shows previous changes

git branch #display local branch
git branch -r #display remote branch
git tag # shows versions of code

git remote add origin https://github.com/someone/project.git # allows to upload there
git push -u origin master #uploads content

NOTE: use proxy server if needed:

set HTTP_PROXY=http://IP:port
set HTTPS_PROXY=https://IP:port
v