Graylog Extractor for Fortigate Firewall

I’ve been using Graylog in production for awhile. It’s a great log analysis tool, backed by elasticsearch. Conceptually, graylog is pretty much like splunk. I consolidate approximately 170-200 million log messages to graylog everyday. So, I need to optimize them well enough.

Few days ago, I started to use Fortigate extractors from a git repo. It uses regex, and it is very slow. So I (have to) write my own extractors. I write Grok pattern, and keep rewriting until I could cover all messages I need to extract. Then, I started to optimize the pattern. The result is quite good though. I could reduce extractor time from more than 100,000 usec to about 100 usec.

extractor

Yes, that’s approximately 1000x times faster. It’s definitely not perfect though, but it works for me. If you think it might be good for you, you can download my Fortigate content pack here.

Enjoy :)

dnsmasq

dnsmasq is the default DNS resolver if you use NetworkManager. It runs pretty well most of the time. When it doesn’t, you would not be able to access the Internet if you need to resolve names.

I’m not a fan of dnsmasq, and if you – like me – want to disable it, just edit

/etc/NetworkManager/NetworkManager.conf

and remove/comment

dns=dnsmasq

Restart NetworkManager, it will use traditional faithful method of /etc/resolv.conf.

Quick install graylog on Ubuntu

Yes, yes, I know. There is the official document to guide you, e.g. http://docs.graylog.org/en/2.0/pages/installation/operating_system_packages.html

BUT, RTFM ! You need to install Java, MongoDB, elasticsearch config, and ensure they run well BEFORE you can run Graylog. That would need skills and time to do it right.

For those Ubuntu people, there is another way. Graylog officially (and constantly) releases a single deb package to update the OVA version. This package includes everything you need to run Graylog, so you can use it to deploy Graylog.

You can simply download the package at https://packages.graylog2.org/omnibus, dpkg -i to install, graylog-ctl to configure and run.

DONE.

 

Remount tmpfs

This is simple, and you can do it without rebooting the machine.

For example, let’s say you have /tmp using tmpfs, and you want to set size to 4 GB:

# mount -o remount,size=4G,noatime /tmp

That’s it.

IBM AMM USB keyboard issue

Many admin faced an issue when using a USB keyboard on IBM Advanced Management Module (AMM) with Linux.

It seems that some Linux distros do not recognize USB device on IBM AMM and then power off the USB port, disconnect a device plugged in.

The solution is quite straightforward: always supply the power to the port.

With udev, you can add the following rules

/lib/udev/rules.d/95-ibm-amm-power-workaround.rules

ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="04b3", ATTR{idProduct}=="4002", TEST=="power/control", ATTR{power/control}="on"

F5 อ่อนว่ะ

ไปร่วมงานสัมมนา “F5 อ่อนว่ะ” ได้ข้อสรุปอย่างหนึ่งที่พี่โดมอาจจะไม่ได้พูดถึง แต่ผมคิดว่าเป็น success factor ของ large scale web นอกเหนือไปจาก design pattern ที่พี่โดมพูดไว้ในงานไปแล้ว นั่นคือ

ทีม

พี่โดมมีทีมที่ทำงานด้วยกันตั้งแต่ออกแบบ วาง infra ยัน software dev นอกจากจะเป็นทีมที่เทคนิคแข็งแกร่ง ประสบการณ์สูงแล้ว ยังเชื่อมต่อพูดคุย product เป็นเนื้อเดียวตั้งแต่ต้นจนจบ

อย่างที่ ดีน กับ ไมเคิล พูดในงาน DevOps Meetup #1 ไว้ว่า DevOps ไม่ใช่ job position ที่ไว้ประสาน / เป็นกันชนระหว่างฝั่ง developers กับฝั่ง IT operations

DevOps มันคือ “mindsets ในการสลาย developer silo กับ IT operation silo

ในอีกแง่หนึ่ง ดีน กับ ไมเคิลบอกว่า มันคือ agile ที่ extend จาก developer-tester (QC) มายัง infra/operations เพื่อ deliver products / monitor indicators / response issues ได้ไว และ แม่นยำ เกิด bottleneck น้อยลงหรือไม่มีเลย

ไม่ต้องมีตำแหน่ง DevOps หรอก ให้สองฝั่งคุยกันเยอะๆ feedback กันเยอะๆ เห็นมุมมอง/ผลกระทบอีกด้านเยอะๆ แค่นั้นก็ทำ DevOps ได้

ผมเห็นทีมพี่โดมเป็นแบบนั้นแหละ .. เป็น DevOps โดยธรรมชาติ

Sort file alphabetically in Samba

It looks like samba sending a list of file names in random order. Of course, you could make it sort alphabetically and make your life easier.

For Debian/Ubuntu

# apt-get install samba-vfs-modules

then edit /etc/samba/smb.conf

[global]
vfs objects = dirsort

Restart your samba, and tada !

งานหนังสือระดับชาติครั้งที่ 20

ในงานหนังสือระดับชาติครั้งที่ 20 / Book Expo Thailand 2015

ณ บูธ Talent 1

  • แมวสามสียอดนักสืบ เล่ม 23 ฆ่าตัวตายที่ชายหาด
  • แมวสามสียอดนักสืบ เล่ม 24 เหตุเกิดจากรับปริญญา
  • คินดะอิจิยอดนักสืบ ตอนที่ 32/1 กระดิ่งลมหัวคน (ปฐมบท)
  • คินดะอิจิยอดนักสืบ ตอนที่ 32/2 กระดิ่งลมหัวคน (ปัจฉิมบท)

รวม 1140 ลด 30% เหลือ 798 บาท

ณ บูธ Online Station เจอ The Moment It Clicks  ปก 395 ลดเหลือ 50 บาท

ณ บูธ อมรินทร์

  • เฉียด (Seconds Away)
  • พบ (Found)
  • ลวง (Missing You)
  • เฉือน (Miracle Cure)
  • สาบสูญ (Six Years)

รวม 1290 ลด 20% เหลือ 1032 บาท

รวมทั้งหมด 2825 จ่ายไป 1880 ลดไปได้ประมาณ 1/3 ของราคาปกล่ะจ้า

12184291_1058740587490872_5923771300789492747_o